Rollback unsaved changes before route change?


#1

How do I rollback change on route change? If I just leave the page I get the following:

Uncaught Error: Attempted to handle event `loadedData` on <App.SomeModel> while in state rootState.loaded.updated.uncommitted. Called with undefined

If I do the following:

App.SomeModelRoute = Ember.Route.extend({
  deactivate: function(){
      thiscontrollerFor("someModel").get("content").forEach(function(obj){
        obj.rollback()
      }
  }
)}

I get:

"Attempted to handle event `becameClean` on <App.SomeModel> while in state rootState.loaded.saved. Called with undefined"

#2

Figured it out, need to do

  obj.get('transaction').rollback()

instead of calling rollback() on object directly