Allow dataSource === false
This commit is contained in:
parent
42318f428c
commit
f798882e9a
|
@ -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 {
|
||||
|
|
|
@ -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', {});
|
||||
});
|
||||
|
|
|
@ -310,7 +310,7 @@ describe('loopback', function() {
|
|||
});
|
||||
|
||||
loopback.configureModel(model, {
|
||||
dataSource: null,
|
||||
dataSource: false,
|
||||
relations: {
|
||||
owner: {
|
||||
model: 'Application'
|
||||
|
|
Loading…
Reference in New Issue