diff --git a/index.js b/index.js index 8f6c6d17..a1e5420e 100644 --- a/index.js +++ b/index.js @@ -4,12 +4,6 @@ exports.ModelBaseClass = require('./lib/model.js'); exports.GeoPoint = require('./lib/geo.js').GeoPoint; exports.ValidationError = require('./lib/validations.js').ValidationError; -var dataSources = exports.dataSources = {}; - -exports.registerDataSource = function(ds) { - dataSources[ds.name] = ds; -}; - exports.__defineGetter__('version', function () { return require('./package.json').version; }); diff --git a/lib/relation-definition.js b/lib/relation-definition.js index 818b5610..3a5b7371 100644 --- a/lib/relation-definition.js +++ b/lib/relation-definition.js @@ -4,7 +4,6 @@ var assert = require('assert'); var util = require('util'); var i8n = require('inflection'); -var jdb = require('../'); var defineScope = require('./scope.js').defineScope; var mergeQuery = require('./scope.js').mergeQuery; var ModelBaseClass = require('./model.js'); @@ -467,7 +466,7 @@ function findBelongsTo(modelFrom, modelTo, keyTo) { * @param {String} modelName The model name * @returns {*} The matching model class */ -function lookupModel(models, modelName, internal) { +function lookupModel(models, modelName) { if(models[modelName]) { return models[modelName]; } @@ -477,15 +476,6 @@ function lookupModel(models, modelName, internal) { return models[name]; } } - if (internal) return; - - var keys = Object.keys(jdb.dataSources); - for (var k = 0; k < keys.length; k++) { - var ds = jdb.dataSources[keys[k]]; - var models = ds.modelBuilder.models; - var model = lookupModel(models, modelName, true); - if (model) return model; - } } function lookupModelTo(modelFrom, modelTo, params, singularize) { diff --git a/test/relations.test.js b/test/relations.test.js index 77619238..eb042903 100644 --- a/test/relations.test.js +++ b/test/relations.test.js @@ -10,7 +10,7 @@ var Person, Address; var Link; var getTransientSchema = function(settings) { - return new Schema('transient', settings); + return new Schema('transient', settings, db.modelBuilder); }; describe('relations', function () { @@ -2423,10 +2423,6 @@ describe('relations', function () { db = getSchema(); tmp = getTransientSchema(); - // register here, so transient models - // can lookup related models (polymorphic) - jdb.registerDataSource(db); - Book = db.define('Book', {name: String}); Author = db.define('Author', {name: String}); Reader = db.define('Reader', {name: String}); diff --git a/test/transient.test.js b/test/transient.test.js index 82b063cb..89c1dd30 100644 --- a/test/transient.test.js +++ b/test/transient.test.js @@ -5,12 +5,12 @@ var assert = require('assert'); var async = require('async'); var should = require('./init.js'); +var db, TransientModel, Person, Widget, Item; + var getTransientSchema = function(settings) { return new Schema('transient', settings); }; -var db, TransientModel, Person, Widget, Item; - describe('Transient connector', function () { before(function () {