How do I edit a record?

Hello,

So, I’ve created a record shown below:

  var newInvoice = this.store.createRecord('invoiced',{
          invoiceName: this.get('invoiced.invoiceName'),
          invoiceAmount: this.get('invoiced.invoiceAmount')
        });

I would like to have an edit button which will take a new input from the user and edit the record selected. How would I go about doing this?

Thanks!

You need to pull the record from the store, make your changes then commit it back:

this.store.findRecord('invoiced', newInvoice.get('id')).then(function(invoice){
    invoice.set('someProperty', someValue);
    invoice.save();
});

HTH