mardi 28 avril 2015

Assertion error in Ember-data has many relationship

I am new to defining relationships in ember. Please help me on this.

This is how i am having relationships.

 App.Post= DS.Model.extend({

     comment: DS.belongsTo('comment'),
     name:     DS.attr('string')
 });

 App.Comment =DS.Model.extend({

    post: DS.belongsTo('Post'),
    value:   DS.attr('string')
 });

 App.PostSerializer = DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
    attrs: {
       comments: {embedded: 'always'}
    }
 });

Whenever i am trying to save post model, i am getting the following error:

Error: Assertion Failed: You must include an id for App.Comment in an object passed to push

I may be wrong on using embedded records. Please help me out on this. Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire