compiler: fix references to loopback
This commit is contained in:
parent
d5cd0a3b50
commit
a3c347d073
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue