sheldonbaker
sheldonbaker

Reputation: 1079

PATCH with ember-data

With ember-data 1.0, is there any way to wrap up a set of changes to a record and only apply those changes once they've successfully hit the server?

My use case is a simple one - there's an 'edit' modal for a Post that's triggered by an 'edit' button. I'm trying to find a way to emulate a traditional form that only updates the Post's attributes when a 'save' button is clicked and the server confirms the patch.

I can use one-way bindings in my TextFields in the modal, but that still doesn't solve the problem of delivering those changed attributes to the server without storing them in the record first.

Is there a way to duplicate a record and use it to persist the changes before throwing it away?

Upvotes: 3

Views: 688

Answers (1)

Kingpin2k
Kingpin2k

Reputation: 47367

Duplication doesn't exist yet, there is talk of it.

Technically the values aren't persisted on the record yet, they are stored on a _attributes hash. On any non-save step (cancel, exiting the route w/o save) you can rollback the record.

Upvotes: 1

Related Questions