vendredi 27 novembre 2015

Modify specific record from an array (method PUT)

I have Model "user" and I have a model that includes an array of objects:

{users: [
 {
   id: 1,
   name: user1,
   status: new
 },
{
   id: 2,
   name: user2,
   status: new
 },
...
]}

But, I have to change the status of a single user. I try:

 actions: {
    checkAccept(id) {
      this.store.findRecord('user', id).then((record) => {
        record.set('status', 'accepted');
        record.save();
      });
 }

With the same method to remove the recording works if used record.DestroyRecord. Why instead PUT method sent GET ???




Aucun commentaire:

Enregistrer un commentaire