You want to do something when your record got saved/validations failed.
Usage
user.observeSaveOnce(success: function(){
// go to next page
}, error: function(){
// show validation errors
})
Code
# your model.js
observeSaveOnce: function(options) {
function callback() {
var outcome = 'success';
if (this.get('isDirty')) {
if (this.get('isValid')) return; // not submitted yet
outcome = 'error';
}
(options[outcome] || Ember.K).call(this);
this.removeObserver('isDirty', callback);
this.removeObserver('isValid', callback);
}
this.addObserver('isDirty', callback);
this.addObserver('isValid', callback);
}