There are a ton of errors in the code for this section-- if you are trying to move create() and cancel() from the controller to the route, this worked for me:
app/routes/sightings/new.js
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return Ember.RSVP.hash({
sighting: this.store.createRecord('sighting'),
cryptids: this.store.findAll('cryptid'),
witnesses: this.store.findAll('witness')
});
},
sighting: Ember.computed.alias('controller.model.sighting'),
actions: {
willTransition() {
var sighting = this.get('controller.model.sighting');
if (sighting.get('hasDirtyAttributes')) {
sighting.deleteRecord();
}
},
create() {
var self = this;
this.get('sighting').save().then(function(data){
self.transitionTo('sightings');
});
},
cancel() {
var self = this;
this.get('sighting').deleteRecord();
self.transitionTo('sightings');
}
}
});