I have the following two routes for edit and new:
WZ.ExercisesNewRoute = Em.Route.extend
model: ->
WZ.Exercise.createRecord()
deactivate: ->
@_super.apply this, arguments
@get('currentModel.transaction').rollback()
WZ.ExercisesEditRoute = Em.Route.extend
model: (params) ->
WZ.Exercise.find(params.exercise_id)
serialize: (params, options) ->
exercise_id: params.get('id')
deactivate: ->
@_super.apply this, arguments
tx = @get('currentModel.transaction')
tx.rollback() if tx
I would like to know what the correct code should be in each deactivate so the store is in a correct state if the user does not save, does save or whatever.
Currently if I route to the edit route and then directly to the new route without saving, I get the following error:
Uncaught Error: Attempted to handle event
willSetProperty
on while in state rootState.deleted.saved. Called with {reference: [object Object], store: , name: name}