diff --git a/lib/persist.js b/lib/persist.js index be1d6c5..3a79000 100644 --- a/lib/persist.js +++ b/lib/persist.js @@ -24,7 +24,7 @@ exports.define = function(name, columnDefs, opts) { return Model.define(name, columnDefs, opts); }; -exports.defineAutoSane = function(name, info, options, callback) { +exports.defineAutoSane = function(name, info, options, defineOpts, callback) { var pluralName = inflection.pluralize(name); if (info.tables.hasOwnProperty(pluralName)) { var columnDefs = info.tables[pluralName].columns; @@ -35,7 +35,10 @@ exports.defineAutoSane = function(name, info, options, callback) { } columnDefs = newColumnDefs; } - var model = Model.define(name, columnDefs); + + // pass options to Model.define so we can set the Model.tableName directly by + // defining defineOpts to be { tableName: 'lalala' } + var model = Model.define(name, columnDefs, defineOpts); callback(null, model); }; };