Last active
August 29, 2015 14:01
-
-
Save etozzato/9df11535a0e9fad01da8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I want to nullify segment_id for the model before saving if it was not changed; | |
// is it okay to mess with _dirtyAttributes ? | |
actions: { | |
updateParticipant: function() { | |
if (!this.get('model._dirtyAttributes').contains('segment_id')) { | |
this.get('model').set('segment_id', null); | |
} | |
return this.get('model').save().then(function() { | |
return console.log("NOTIFY THE USER!"); | |
}); | |
} | |
} |
Assuming Ember Data, then you can use model.changedAttributes()
.
See http://emberjs.com/guides/models/working-with-records/#toc_modifying-attributes for more details.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this works but I don't like it...