Clean up after cancelling new model creation

Fixes #27
This commit is contained in:
Matthew Dillon 2015-10-29 16:41:50 -07:00
parent 6ab7e66d03
commit 6dbdd70d31
8 changed files with 27 additions and 17 deletions

View file

@ -13,12 +13,16 @@ export default Ember.Controller.extend({
ajaxError(strain.get('errors'), this.get('flashMessages'));
});
} else {
this.transitionToRoute('protected.strains.index');
strain.destroyRecord().then(() => {
this.transitionToRoute('protected.strains.index');
});
}
},
cancel: function() {
this.transitionToRoute('protected.strains.index');
this.get('strain').destroyRecord().then(() => {
this.transitionToRoute('protected.strains.index');
});
},
},