-
-
Save jordan-brough/7d0a00c2c03e5a053144 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/backbone.js b/backbone.js | |
index 4217e62..bdc6682 100644 | |
--- a/backbone.js | |
+++ b/backbone.js | |
@@ -906,11 +906,11 @@ | |
// Useful when interfacing with server-side languages like **PHP** that make | |
// it difficult to read the body of `PUT` requests. | |
Backbone.sync = function(method, model, success, error) { | |
var type = methodMap[method]; | |
var modelJSON = (method === 'create' || method === 'update') ? | |
- JSON.stringify(model.toJSON()) : null; | |
+ JSON.stringify(model.toParams ? model.toParams() : model.toJSON()) : null; | |
// Default JSON-request options. | |
var params = { | |
url: getUrl(model), | |
type: type, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment