Skip to content
This repository

custom data in Backbone.sync #154

Closed
dvv opened this Issue December 21, 2010 · 3 comments

2 participants

Vladimir Dronnikov Jeremy Ashkenas
Vladimir Dronnikov

https://github.com/documentcloud/backbone/blob/master/backbone.js#L945 -- possible to check whether model already is a string and suppress JSON.stringify(model.toJSON()) if yes?

The rationale is to provide for ability to pass custom data and thus making all custom ajax calls consistently via Backbone.sync()

--Vladimir

Jeremy Ashkenas
Owner

We could do that, but why not just pass the data as a JS object?

Also, you should be able to set options.data to any value you desire.

Vladimir Dronnikov

There's no chance to pass options.data since we'll get first TypeError on: 1) null/undefined model; 2) object w/o .toJSON(). So one must pass an object looking like a valid model even if he wants to just pass options.data.

Thus the issue.

Jeremy Ashkenas
Owner

Alright -- I've made options.data a viable solution with the patch at SHA: 4c1bdb4. Thanks for the ticket.

Jason Webster jasonwebster referenced this issue from a commit in jasonwebster/backbone December 30, 2010
Jeremy Ashkenas Issue #154. Make options.data possible for creates and updates with t…
…he default sync.
4c1bdb4
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.