Skip to content

Commit

Permalink
Fixed error on instance removal
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Jan 15, 2014
1 parent 033f10b commit 480b268
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Instance.js
Expand Up @@ -211,15 +211,15 @@ Instance.prototype.remove = Instance.prototype.delete = function(callback) {
if(this.__state.isNew) return (callback || function() { })(null, 0);

var conditions = this.__state.model.uniqueConditions(this.__state.modified);
this.__state.model.cache.drop(conditions, function() {
this.__state.model.cache.drop(conditions, (function() {
this.emit('removing', this);
this.__state.model.collection.remove(conditions, { w: callback ? 1 : 0 }, (function(err, removed) {
if(err) this.emit('error', err);
else this.emit('removed', this);
this.__state.isNew = true;
return callback(err, removed);
}).bind(this));
});
}).bind(this));
};

Instance.prototype.select = function(collection, filter) {
Expand Down

0 comments on commit 480b268

Please sign in to comment.