Given the models:
Blog.Post = DS.Model.extend({
title: DS.attr('string'),
tags: DS.hasMany('Blog.Tag', { embedded: true })
});
Blog.Tag = DS.Model.extend({
foo: DS.attr('string'),
bar: DS.attr('string')
});
And instance:
var myPost = Blog.Post.createRecord({ id: 45, title: 'Foo Bar' })
When I do myPost.store.commit()(via ember-data DS.RESTAdapter), my server returns a list of automatically generated tags that should be applied to myPost. Example json response:
{
posts: [
{
id: 45,
title: 'Foo Bar',
tags: [
{ id: 1, foo: 'bar1' },
{ id: 2, foo: 'bar2' }
]
}
]
}
I would expect it to myPostfinish with two tags returned by json, but instead I get this error:
Error: <DS.StateManager:ember448> could not respond to event invokeLifecycleCallbacks in state rootState.loaded.updated.uncommitted.
What am I doing wrong here?
Edit: Refine json to include identifiers in @MikeAski comment. The above example is a simplified version of my actual case - the actual case includes tag identifiers.
source
share