Ember Data, rollback with Ember.Select


#1

I’m having some issues with trying to create a view to add a new record of a particular model. In this view there’s a cancel button which will rollback the model and then transition to the index route. I want this to be done in that particular order since the transition will trigger dirty checking and alert the user if the model i dirty when the transition is about to occur. And since the user initiated the transition with the cancel button they shouldn’t have to confirm that hey want to roll back the model.

But when I do it in this particular order, the Ember.Select views in the template will try to re-set the value on the now deleted model and an exception is thrown.

I’ve got a couple of workarounds for this, but I’d like to see if anyone has got an even better approach.

  1. Transition first, somehow prevent the confirm dialog and then rollback after transitioning
  2. Add prompt attribute to Ember.Select

The second workaround wouldn’t really work since most of the attributes doesn’t allow for an empty value.

Any suggestions on how to approach this?