Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PATCH support in sync function #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nneufeld
Copy link

As per the backbone documentation for model.save(http://backbonejs.org/#Model-save)

If instead, you'd only like the changed attributes to be sent to the server, call model.save(attrs, {patch: true}). You'll get an HTTP PATCH request to the server with just the passed-in attributes.

This currently doesn't work when including backbone_rails_sync, as the data option was always being set to model.toJSON, which returns all the model's attributes, when in fact it should be set to options.attrs if it's present, which contains only the attributes that have been changed when using the patch option.

… sent to the server rather than the entire model.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant