diff --git a/lib/loopback.js b/lib/loopback.js index d5db06df..ab0a79e2 100644 --- a/lib/loopback.js +++ b/lib/loopback.js @@ -243,7 +243,8 @@ loopback.autoAttach = function() { Object.keys(models).forEach(function(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); } });