mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-23 22:08:04 -05:00
Fixing Collection#create success callback, passing the model parameter through.
This commit is contained in:
@@ -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});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user