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?
Temporary solution is to manually call record.send('becomeDirty')
after modifying the record's relationships.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With