From b8f94f5777721962ad9bfe8959ac8889f3535443 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Mon, 7 Oct 2013 18:01:31 -0700 Subject: [PATCH] Make sure foreign key properties are fully registered --- lib/datasource.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/datasource.js b/lib/datasource.js index 13f8c171..e8bfaf54 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -1256,7 +1256,8 @@ DataSource.prototype.defineForeignKey = function defineForeignKey(className, key if (this.connector.defineForeignKey) { var cb = function (err, keyType) { if (err) throw err; - this.definitions[className].defineProperty(key, {type: keyType}); + // Add the foreign key property to the data source _models + this.defineProperty(className, key, {type: keyType || Number}); }.bind(this); switch (this.connector.defineForeignKey.length) { case 4: @@ -1268,10 +1269,10 @@ DataSource.prototype.defineForeignKey = function defineForeignKey(className, key break; } } else { - this.definitions[className].defineProperty(key, {type: Number}); + // Add the foreign key property to the data source _models + this.defineProperty(className, key, {type: Number}); } - - this.models[className].registerProperty(key); + }; /**