Context-sensitive save-model mixin

This commit is contained in:
Matthew Dillon 2015-11-17 16:36:08 -07:00
parent 2bbb29d785
commit e45ca02afb

View file

@ -23,11 +23,16 @@ export default Mixin.create({
cancel: function() {
const model = this.get('model');
const isNew = model.get('isNew');
model.get('errors').clear();
model.rollbackAttributes();
if (isNew) {
this.transitionToRoute(this.get('fallbackRouteCancel'));
} else {
this.transitionToRoute(this.get('fallbackRouteCancel'), model);
}
},
},
});