Fix ReferenceError: definition is not defined

occure when try to delete object in has one relation, but object not created yet
This commit is contained in:
Dmitry Manannikov 2015-05-22 00:37:27 +03:00
parent 12dea6e1cb
commit 91b04655cd
1 changed files with 1 additions and 0 deletions

View File

@ -1753,6 +1753,7 @@ HasOne.prototype.destroy = function (options, cb) {
options = {};
}
cb = cb || utils.createPromiseCallback();
var definition = this.definition;
this.fetch(function(err, targetModel) {
if (targetModel instanceof ModelBaseClass) {
targetModel.destroy(options, cb);