Reputation: 2286
I've got a model in my Ember application that has a hasMany relationship:
App.Book = DS.Model.extend({
tags: DS.hasMany('tag')
});
The problem is that when adding/removing a tag to/from a book, the book model itself does not become "dirty". For example:
book = this.store.find('book', 123);
book.get('tags.length')
==> 0
tag = this.store.find('tag', 456);
book.get('tags').pushObject(tag);
book.get('tags.length')
==> 1
book.get('isDirty') // should be true, but is false
==> false
It seems to me that book
instance should now be dirty since one of its relationships was changed. What am I doing wrong?
Upvotes: 7
Views: 1725
Reputation: 2286
Temporary solution is to manually call record.send('becomeDirty')
after modifying the record's relationships.
Upvotes: 2