From 7f6398f4c50b44d53f4c33c9cfd60e73cadb1de8 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Fri, 15 Nov 2013 13:54:15 -0800 Subject: [PATCH] Fix the reference to modelBuilder/dataSource --- lib/model-builder.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/model-builder.js b/lib/model-builder.js index 0d49dd7a..af8f2bcb 100644 --- a/lib/model-builder.js +++ b/lib/model-builder.js @@ -140,7 +140,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett // every class can receive hash of data as optional param ModelClass = function ModelConstructor(data, dataSource) { if(!(this instanceof ModelConstructor)) { - return new ModelConstructor(data, modelBuilder); + return new ModelConstructor(data, dataSource); } if(ModelClass.settings.unresolved) { throw new Error('Model ' + ModelClass.modelName + ' is not defined.'); @@ -172,6 +172,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett // Add metadata to the ModelClass hiddenProperty(ModelClass, 'modelBuilder', modelBuilder); + hiddenProperty(ModelClass, 'dataSource', modelBuilder); // Keep for back-compatibility hiddenProperty(ModelClass, 'pluralModelName', pluralName || inflection.pluralize(className)); hiddenProperty(ModelClass, 'relations', {});