dagda1
dagda1

Reputation: 28820

Ember-data 0.14, setting belongsTo does not dirty the record

I have recently upgraded to ember-data 0.14 and setting a belongsTo relationship no longer dirties the record.

Say I have:

App.User = DS.Model.extend({
  firstName: DS.attr('string'),
  surname: DS.attr('string')
});

App.Contact = DS.Model.extend({
    firstName: DS.attr('string'),
    surname: DS.attr('string'),
    user: DS.belongsTo('App.User')
});

If I have a contact and change the user, isDirty is false:

e.g.

contact.set('user', newUser);
contact.get('isDirty'); //false

I created this jsbin but it works with the fixture adapter.

I am using the RESTAdapter and it does not work.

I am wondering if this is anything to do with the observer changes in ember 1.0?

If I roll the code back to rc7 and 0.14 the exact same code works so something in 1.0 is stopping the change being registered.

What happens when a belongsTo is set in ember-data? Where in the code should I be looking?

Upvotes: 1

Views: 710

Answers (1)

dagda1
dagda1

Reputation: 28820

After much digging about, it turned out to be a problem with suspendListeners that is fixed in this commit with Ember.

Upvotes: 2

Related Questions