From 91b04655cd29660d34104f51104d5a97ef7a9106 Mon Sep 17 00:00:00 2001 From: Dmitry Manannikov Date: Fri, 22 May 2015 00:37:27 +0300 Subject: [PATCH] Fix ReferenceError: definition is not defined occure when try to delete object in has one relation, but object not created yet --- lib/relation-definition.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/relation-definition.js b/lib/relation-definition.js index 918af0b2..3b574331 100644 --- a/lib/relation-definition.js +++ b/lib/relation-definition.js @@ -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);