Only send the model on create and update... It's better for destroy not to bother with it.

This commit is contained in:
Jeremy Ashkenas
2010-10-17 10:17:36 -04:00
parent 263245b9cf
commit 6899988224

View File

@@ -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],