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

Sails not global, sails is not defined #3

Open
jaumard opened this issue Jul 27, 2015 · 1 comment
Open

Sails not global, sails is not defined #3

jaumard opened this issue Jul 27, 2015 · 1 comment

Comments

@jaumard
Copy link

jaumard commented Jul 27, 2015

Hi,

In my projet sails is not set as global. And there is an error under _loadPolicies.js cause it used
sails.config.paths.policies but sails is undefined. Is there any way to fix this ?

Thanks

@saviogl
Copy link
Owner

saviogl commented Aug 7, 2015

Hello Jaumard,

Could you give more information regarding your problem?

All I've done to extend sails policies was to override loadPolicies function, to loop through an array of policies path extended by the plugin, but the core of the function remains pretty much the same, and still references "sails.config.paths.policies" as shown below:

    // Original function taken from Sails
    // sails/lib/hooks/moduleloader/index.js - loadPolicies
    /**
     * Load app policies
     *
     * @param {Object} options
     * @param {Function} cb
     */
    loadPolicies: function (cb) {
      buildDictionary.optional({
        dirname: sails.config.paths.policies,
        filter: /(.+)\.(js|coffee|litcoffee)$/,
        replaceExpr: null,
        flattenDirectories: true,
        keepDirectoryPath: true
      }, bindToSails(cb));
    },

So you would be getting this error for any load of sails wouldn't you?

Feel free to fork the repository and send a pull request, it would be highly appreciated.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants