Let's say I have 2 models:
App.Address = DS.Model.extend({ street: DS.attr('string'), person: DS.belongsTo('App.Person') }) App.Person = DS.Model.extend({ name: DS.attr('string'), addresses: DS.hasMany('App.Address') })
Now i create man
App.person = App.Person.createRecord({name: 'Bill'}); App.store.commit();
If I try to add an address to a person like this
address = App.Address.createRecord({street: '123 Fake Street'}); App.person.get('addresses').pushObject(address);
and make a transaction
App.store.commit();
The new address will be saved, however the person object will not be recognized as changed; even though the list of identifiers went from
{ ... "addresses": [] }
to
{ ... "addresses": [3] }
Is there any way to let ember-data know that my face object has been changed and needs to be saved?
Edit: Here is a jsfiddle illustrating the problem.
Camhaft
source share