[Pkg-javascript-commits] [backbone] 19/34: Don't send up model data for GET requests by default, for folks who are re-fetching existing collections.

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:58:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.1.2
in repository backbone.

commit 5c5b7a88241f0e7997c5d1d61796133c5a00a6f1
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Sat Oct 16 16:05:49 2010 -0400

    Don't send up model data for GET requests by default, for folks who are re-fetching existing collections.
---
 backbone.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/backbone.js b/backbone.js
index c219f51..d6fc474 100644
--- a/backbone.js
+++ b/backbone.js
@@ -603,10 +603,11 @@
   // * Persist models via WebSockets instead of Ajax.
   //
   Backbone.sync = function(method, model, success, error) {
+    var data = method === 'read' ? {} : {model : JSON.stringify(model)};
     $.ajax({
       url       : getUrl(model),
       type      : methodMap[method],
-      data      : {model : JSON.stringify(model)},
+      data      : data,
       dataType  : 'json',
       success   : success,
       error     : error

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list