diff --git a/lib/executor.js b/lib/executor.js index ba55438..8a238dd 100644 --- a/lib/executor.js +++ b/lib/executor.js @@ -127,7 +127,7 @@ function setupDataSources(app, instructions) { } function setupModels(app, instructions) { - defineModels(instructions); + defineModels(app, instructions); instructions.models.forEach(function(data) { // Skip base models that are not exported to the app @@ -137,20 +137,20 @@ function setupModels(app, instructions) { }); } -function defineModels(instructions) { +function defineModels(app, instructions) { instructions.models.forEach(function(data) { var name = data.name; var model; if (!data.definition) { - model = loopback.getModel(name); + model = app.loopback.getModel(name); if (!model) { throw new Error('Cannot configure unknown model ' + name); } debug('Configuring existing model %s', name); } else { debug('Creating new model %s %j', name, data.definition); - model = loopback.createModel(data.definition); + model = app.loopback.createModel(data.definition); if (data.sourceFile) { debug('Loading customization script %s', data.sourceFile); var code = require(data.sourceFile);