Prevent autoAttach from overriding existing data source
This commit is contained in:
parent
73390a6be8
commit
8a114c635f
|
@ -243,7 +243,8 @@ loopback.autoAttach = function() {
|
||||||
Object.keys(models).forEach(function(modelName) {
|
Object.keys(models).forEach(function(modelName) {
|
||||||
var ModelCtor = models[modelName];
|
var ModelCtor = models[modelName];
|
||||||
|
|
||||||
if(ModelCtor) {
|
// Only auto attach if the model doesn't have an explicit data source
|
||||||
|
if(ModelCtor && (!(ModelCtor.dataSource instanceof DataSource))) {
|
||||||
loopback.autoAttachModel(ModelCtor);
|
loopback.autoAttachModel(ModelCtor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue