I want to create a new site record. The model looks like:
var SiteModel = DS.Model.extend({
name: attr(),
...
languages: DS.hasMany('language'),
});
The language
property describes in which languages the content of a site can be written. To create the form, I need to create a model in my route. So I want to create a new record, without saving this one to the db:
var WebsitesNewRoute = Ember.Route.extend({
model: function() {
return this.store.createRecord('site', {
languages: Ember.A()
});
}
}
That does not work as intended, as I got the following error: cannot set read-only property "languages" on object: <app@model:site::ember1012:null>>
. Why is the languages
property readOnly? As far as I know I did not configure that in my model...
I know the question Ember Data- createRecord in a hasMany relationship, but in my case I don't want to save anything yet (I only want to create the model, so I could use it in my template).