I have two simple models in my Ember application that work like so:
App.Book = DS.Model.extend({
tags: DS.hasMany('tag')
});
App.Tag = DS.Model.extend({
books: DS.hasMany('book', { async: true })
});
Users can easily add and remove tags to a given book via our UI. The code that runs when a user removes a tag, for example, is:
book.get('tags').removeRecord(tagToRemove);
book.save();
This works just fine in removing the tag from the book. However, the tag model itself still references the book. In other words, the inverse relationship is not automatically updated.
EDIT:
After doing a JS Bin (http://jsbin.com/ucanam/1574/edit), it seems the reason the tag's books
property is not updating automatically is because of the { async: true }
option I passed. That said, I'm not sure I can really afford to remove that option, because a tag may have millions of books and I don't want to load all of them with the tag.
Any way to get things working as-is?