1

I am trying to set up a some simple CRUD operations using ember-model. While editing a model in my app, I want there to be a "cancel edit" option. This should undo any changes that where made to the data, even if they were not saved to the store.

I know that with ember-data I could simply call "model.rollback()" but I do not see a way to do this with ember-model. Is there a way to achieve this functionality with ember-model?

Basically, how would you turn this code that works with ember-data into something I can use with ember-model?

cancelEdit: function() {
    this.get('model').rollback();
    this.set('isEditing', false);
}

Also this is the first question I have asked on this site so any tips for the proper way to ask questions would be welcome

SuperPig
  • 70
  • 7

1 Answers1

1

In Ember model the function name is revert

model.revert();
Kingpin2k
  • 47,277
  • 10
  • 78
  • 96
  • I think ember doesn't support revert() any more and has changed the function to rollback() - http://emberjs.com/api/data/classes/DS.Model.html#method_rollback – Pascal Jan 12 '15 at 11:07
  • This is for Ember Model, not Ember Data, they are two different products :) – Kingpin2k Jan 12 '15 at 16:38