Merge pull request #1329 from strongloop/feature/allow-datasource-false

Allow dataSource === false
This commit is contained in:
Raymond Feng 2015-04-24 08:46:31 -07:00
commit 99d23bb7c4
3 changed files with 6 additions and 2 deletions

View File

@ -236,7 +236,7 @@ Registry.prototype.configureModel = function(ModelCtor, config) {
ModelCtor.attachTo(config.dataSource); ModelCtor.attachTo(config.dataSource);
debug('Attached model `%s` to dataSource `%s`', debug('Attached model `%s` to dataSource `%s`',
modelName, config.dataSource.name); modelName, config.dataSource.name);
} else if (config.dataSource === null) { } else if (config.dataSource === null || config.dataSource === false) {
debug('Model `%s` is not attached to any DataSource by configuration.', debug('Model `%s` is not attached to any DataSource by configuration.',
modelName); modelName);
} else { } else {

View File

@ -604,6 +604,10 @@ describe('app', function() {
app.model('MyTestModel', { dataSource: null }); app.model('MyTestModel', { dataSource: null });
}); });
it('accepts false dataSource', function() {
app.model('MyTestModel', { dataSource: false });
});
it('should not require dataSource', function() { it('should not require dataSource', function() {
app.model('MyTestModel', {}); app.model('MyTestModel', {});
}); });

View File

@ -310,7 +310,7 @@ describe('loopback', function() {
}); });
loopback.configureModel(model, { loopback.configureModel(model, {
dataSource: null, dataSource: false,
relations: { relations: {
owner: { owner: {
model: 'Application' model: 'Application'