nytimes / backbone.trackit

Manage unsaved changes in a Backbone Model.
202 stars 33 forks source link

model.unsavedAttributes() question #4

Closed nikmartin closed 10 years ago

nikmartin commented 10 years ago

Can model.unsavedAttributes() be used for PATCH operations? I am trying to minimize the conflicts between multiple users saving the same model, replacing an entire model on the server when only 1 attribute has changed. Since I am also using the wonderful stickit, my client side model changes a LOT, and is large. This increases the likelyhood of model saves overwriting other parts of the model that have changes by an order of magnitude. I thought that the patch:true would be my saving grace, but stickit gurantees that the changedAttributes hash only has one item in it.

So, can I do:

model.save(model.unsavedAttributes(),{patch:true});

Notwithstanding any server side changes I have to make to accommodate this.

delambo commented 10 years ago

Patch method support is on master. Let me know if it works out for you.