I have two models. Lets call them mult
and post
. They have a many to many relationship.
Their definitions looks like:
Post:
export default Model.extend({
name: attr(),
mult: hasMany('mult')
});
Mult:
export default Model.extend({
name: attr(),
perspectives: hasMany('post')
});
I want to start off by creating a Post
and adding Mults
to it. So, I do
createPost(name) {
let post = this.get('store').createRecord('post', {
name: name, mults: []
});
post.save();
},
in my controller.js. However, this then throws an exception of
mult.js:3 Uncaught TypeError: (0 , _emberData.default) is not a function
and it is referring to this line of mult
:
name: (0, _emberData['default'])(),
Can I create a post
first without providing any mults
? If so, what might be a suggested workaround?
Aucun commentaire:
Enregistrer un commentaire