diff --git a/lib/railway.js b/lib/railway.js index 172ba051..a0138724 100644 --- a/lib/railway.js +++ b/lib/railway.js @@ -52,7 +52,7 @@ module.exports = function init(root) { schema.log = log; railway.orm._schemas.push(schema); -var context = prepareContext(railway, app, schema); +var context = prepareContext(models, railway, app, schema); // run schema first var schemaFile = (root || app.root) + '/db/schema.'; @@ -65,7 +65,7 @@ if (existsSync(schemaFile + 'js')) { } if (schemaFile) { - var code = fs.readFileSync(schemaFile); + var code = fs.readFileSync(schemaFile).toString(); if (schemaFile.match(/\.coffee$/)) { code = require('coffee-script').compile(code); } @@ -104,9 +104,9 @@ function log(str, startTime) { }); } -function prepareContext(railway, app, defSchema, done) { +function prepareContext(models, railway, app, defSchema, done) { var ctx = {app: app}, - models = {}, + _models = {}, settings = {}, cname, schema,