Pass instance as callback second arg when validation fails
This commit is contained in:
parent
894a924488
commit
e55b29e479
|
@ -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(){
|
||||
|
|
Loading…
Reference in New Issue