Fixes #935. ensuring that sync is triggered on the collection after the model is removed.

This commit is contained in:
Jeremy Ashkenas
2012-02-02 14:09:54 -05:00
parent dfc966272f
commit 0cbcdc96eb

View File

@@ -341,11 +341,13 @@
if (this.isNew()) return triggerDestroy();
options.success = function(resp) {
var col = model.collection;
if (options.wait) triggerDestroy();
if (success) {
success(model, resp);
} else {
model.trigger('sync', model, resp, options);
if (col) col.trigger('sync', model, resp, options);
}
};
options.error = Backbone.wrapError(options.error, model, options);