I would like to redefine my buildURL depending on what properties changed on the same model. For example, if the status changed, I would like to PUT to a certain route, and if the subuser changed, I would like to PUT to another route.
Example :
this.store.find('conversation', conv.id).then(function(conversation){
conversation.set('status', 'opened');
conversation.save();
});
This would use a certain PUT route and this :
this.store.find('conversation', this.get('selectedConv').id).then(function(conversation){
conversation.set('subuser', subuser);
conversation.set('url', subuser.get('email'));
conversation.save();
});
And this would use another PUT route even tho the changes are made on the same model. This is all happening in a controller.
You need to customize your
conversation
adapter, specifically theurlForUpdateRecord
method.The original method looks like this:
In this method, you need to examine the snapshot and adjust the URL accordingly.
The latest version of Ember Data has introduced the changedAttributes property. This seems to be what you need.
Good luck!