Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am martinmaillard on github.
  • I am martinmaillard (https://keybase.io/martinmaillard) on keybase.
  • I have a public key whose fingerprint is 5537 4AA5 1265 DF61 5B66 935A 130E 51C9 889E AAF3

To claim this, I am signing this object:

@martinmaillard
martinmaillard / ember_model_changes.js
Created September 30, 2014 18:12
Ember: discard changes when leaving page
/**
* Rolls back changes on a model (and deletes new models) when leaving
* the page without saving. The user will also be notified if the model
* has changed when trying to leave the page.
*/
App.HandleModelChanges = Ember.Mixin.create({
deactivate: function() {
var model = this.get('controller.model');
model.rollback();