mercredi 10 juin 2015

Defining buildURL depending on what properties have changed

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.

Aucun commentaire:

Enregistrer un commentaire