parent
6ab7e66d03
commit
6dbdd70d31
8 changed files with 27 additions and 17 deletions
|
@ -13,7 +13,7 @@ export default Ember.Controller.extend({
|
|||
ajaxError(strain.get('errors'), this.get('flashMessages'));
|
||||
});
|
||||
} else {
|
||||
strain.deleteRecord().then(() => {
|
||||
strain.destroyRecord().then(() => {
|
||||
this.transitionToRoute('protected.strains.show', strain);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
|
|
|
@ -25,11 +25,11 @@ export default Ember.Route.extend({
|
|||
|
||||
actions: {
|
||||
willTransition: function(/*transition*/) {
|
||||
let controller = this.get('controller');
|
||||
let strain = controller.get('strain');
|
||||
const controller = this.get('controller');
|
||||
const strain = controller.get('strain');
|
||||
|
||||
if (strain.get('isNew')) {
|
||||
strain.deleteRecord();
|
||||
strain.destroyRecord();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
Reference in a new issue