Update object only when form is submitted
dgeb opened this issue · 3 comments
Two possible approaches:
- edit a copy of the contact and apply changes when the form is submitted
- save the original version of the object and then revert to it on cancel
Rather than doing something custom, I'd like to figure out if ember-data will provide a model state concept for handling this.
We used https://github.com/derickbailey/backbone.memento for this in my recent Backbone project. I'd love to see what the Ember community comes up with. Ember-data seems like it might be a while.
@CodeOfficer - Thanks for the pointer. Memento looks like it takes a pretty rigorous approach, including a change stack as well as support for collections. The difficulty in writing an ember-data example is that I want to do things "the ember-data way", even though that may not have been worked out yet. Since this seems like a pretty common pattern, I would expect support for it in ember-data eventually.
Form edits are now contained in transactions, which are committed on submit() or rolled back on cancel().