Skip to content

Instantly share code, notes, and snippets.

@amiel
Created August 6, 2014 20:56
Show Gist options
  • Save amiel/a119d42a62bc04649d81 to your computer and use it in GitHub Desktop.
Save amiel/a119d42a62bc04649d81 to your computer and use it in GitHub Desktop.
var controller = this;
var success = function(model) {
controller.transitionToRoute('...');
};
var failure = function(xhr) {
controller.get('model').rollback();
if (xhr.status == 400) {
controller.showError($.parseJSON(xhr.responseText).detail);
}
};
this.get('model').save().then(success, failure);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment