diff --git a/lib/datasource.js b/lib/datasource.js index dda360e9..62e1a688 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -1241,6 +1241,10 @@ DataSource.prototype.discoverAndBuildModels = function (modelName, options, cb) } var models = self.modelBuilder.buildModels(schemaList); + // Now attach the models to the data source + for(var m in models) { + models[m].attachTo(self); + } cb && cb(err, models); }); };