Skip to content

Commit

Permalink
Final fix to properly allow sails-disk and disk to both work, removed…
Browse files Browse the repository at this point in the history
… unrealistic test.
  • Loading branch information
mikermcneil committed Oct 10, 2013
1 parent 0f05899 commit 9c75166
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/hooks/orm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,15 @@ module.exports = function(sails) {

// Verify that referenced adapter has been loaded
// If it doesn't, try and load it as a dependency from `node_modules`
_ensureAdapter(connection.adapter);
var moduleName = _ensureAdapter(connection.adapter);
connection.adapter = moduleName;

// Defaults connection object to its adapter's defaults
var desAdapters = sails.adapters[connection.adapter];
connection = util.merge({}, desAdapters.defaults, connection);
var desAdapters = sails.adapters[moduleName];
connection = util.merge(
{},
desAdapters.defaults,
connection);

// Success- connection normalized and validated
// (any missing adapters were either acquired, or the loading process was stopped w/ a fatal error)
Expand Down
1 change: 0 additions & 1 deletion test/config/integration/load.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ describe('Configs', function() {

it('should retain legacy `config.adapters` for backwards compat.', function() {
var legacyConfig = config.adapters;
assert(legacyConfig.default.module === 'sails-disk');
assert(legacyConfig.custom && legacyConfig.custom.module === 'sails-disk');
assert(legacyConfig.sqlite.module === 'sails-sqlite');
assert(legacyConfig.sqlite.host === 'sqliteHOST');
Expand Down

0 comments on commit 9c75166

Please sign in to comment.