From 931338ea14ae5e6f87b4e22b545354f19b58bef4 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Wed, 20 Oct 2010 14:57:40 -0400 Subject: [PATCH] Fixing Collection#create success callback, passing the model parameter through. --- backbone.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backbone.js b/backbone.js index a2f43f24..cf5b8b2d 100644 --- a/backbone.js +++ b/backbone.js @@ -417,10 +417,10 @@ create : function(model, options) { options || (options = {}); if (!(model instanceof Backbone.Model)) model = new this.model(model); - model.collection = this; - var success = function(resp) { - model.collection.add(model); - if (options.success) options.success(model, resp); + var coll = model.collection = this; + var success = function(nextModel, resp) { + coll.add(nextModel); + if (options.success) options.success(nextModel, resp); }; return model.save(null, {success : success, error : options.error}); },