SuperMarco
SuperMarco

Reputation: 721

Ember-data update a record

I can't find anything anywhere, but it is possible to modify a record inside the store with ember-data ?

I know there is store.createRecord( 'user', { name: bob}); But how can I do to be able to modify a specific record ?

Like this : store.updateRecord( 'user', recordToModify, newData) ?

Is there anything already available by ember-data or I should just write it by myself ?

Upvotes: 1

Views: 101

Answers (1)

bcmcfc
bcmcfc

Reputation: 26745

DS.Model provides a save method:

recordToModify.set('someAttribute', 'someValue');

recordToModify.save().then(function() {
  // Success callback
}, function() {
  // Error callback
});

Upvotes: 1

Related Questions