Pass instance as callback second arg when validation fails

This commit is contained in:
Anatoliy Chakkaev 2011-11-18 16:00:11 +07:00
parent 894a924488
commit e55b29e479
1 changed files with 3 additions and 1 deletions

View File

@ -204,6 +204,8 @@ AbstractClass.toString = function () {
}
/**
* Save instance. When instance haven't id, create method called instead.
* Triggers: validate, save, update | create
* @param options {validate: true, throws: false} [optional]
* @param callback(err, obj)
*/
@ -224,7 +226,7 @@ AbstractClass.prototype.save = function (options, callback) {
if (options.throws) {
throw err;
}
return callback && callback(err);
return callback && callback(err, this);
}
this.trigger("save", function(){