[Pkg-javascript-commits] [backbone] 21/34: Only send the model on create and update... It's better for destroy not to bother with it.

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:58:45 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 689998822426ce3160631571085dbc97032cf515
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Sun Oct 17 10:17:36 2010 -0400

    Only send the model on create and update... It's better for destroy not to bother with it.
---
 backbone.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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

-- 
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