Fix the reference to modelBuilder/dataSource

This commit is contained in:
Raymond Feng 2013-11-15 13:54:15 -08:00
parent e51c8971f9
commit 7f6398f4c5
1 changed files with 2 additions and 1 deletions

View File

@ -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', {});