Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes sails.models and sails.adapters references #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,17 @@ module.exports = function (sails) {
// (This particular timing-- before initialize()-- is for backwards compatibility.
// Originally it was so that other hooks could mix in models/adapters. Note that
// this behavior may change in a future version of Sails.)
if (!sails.hooks.orm.models) {
sails.hooks.orm.models = {};
// Expose a reference to `hook.models` as `sails.models`
sails.models = sails.hooks.orm.models;
if (!sails.models) {
sails.models = {};
}
if (!sails.hooks.orm.adapters) {
sails.hooks.orm.adapters = {};
// Expose a reference to `hook.adapters` as `sails.adapters`
sails.adapters = sails.hooks.orm.adapters;
// Expose a reference to `sails.models` as `hook.models`
sails.hooks.orm.models = sails.models;

if (!sails.adapters) {
sails.adapters = {};
}
// Expose a reference to `sails.adapters` as `hook.adapters`
sails.hooks.orm.adapters = sails.adapters;

// Look for the `connections` config, and if found, log a deprecation message
// and move it to `datastores`.
Expand Down