Merge pull request #1329 from strongloop/feature/allow-datasource-false
Allow dataSource === false
This commit is contained in:
commit
99d23bb7c4
|
@ -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 {
|
||||||
|
|
|
@ -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', {});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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'
|
||||||
|
|
Loading…
Reference in New Issue