Allow dataSource === false

This commit is contained in:
Raymond Feng 2015-04-24 08:32:17 -07:00
parent 42318f428c
commit f798882e9a
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);
debug('Attached model `%s` to dataSource `%s`',
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.',
modelName);
} else {

View File

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

View File

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