Apologies in advance, I'm very new to Ember and javascript.
I've been following the tutorial at https://medium.com/@jamesfuthey/a-gentle-introduction-to-ember-2-0-8ef1f378ee4#.mis7qdebs
He's introduced a pattern of creating components and putting all of the actions in the components and routes instead of using a controller. I want to know how to update a record in the database (firebase).
I didn't explicitly create an ID in my model, so I was trying to find a specific record using one of the attributes, but it's not working. I get the error of
Error: no record was found at https://taskline.firebaseio.com/tasks/taskname
Which I think is happening because my syntax for findRecord is wrong. I thought I was following the convention as described in the docs https://guides.emberjs.com/v2.4.0/models/creating-updating-and-deleting-records/
updateTask: function (model) {
let task = this.store.findRecord('task', 'taskname').then(function(task){
task.set( 'taskname', model.taskname);
task.set( 'startdate', model.startdate);
task.set( 'enddate', model.enddate);
task.set( 'banding', model.banding);
});
task.save();
}
then additionally I get an error
Uncaught TypeError: undefined is not a function index.js:26
updateTask
which appears to be thrown by the same function. can anyone redirect me here?