Reputation: 289
I've been following this screencast, I've created a policy in api/policies/flash.js
. I then tried making this policy usable to all of my controllers in config/policies
using
module.exports.policies = {
'*': 'flash'
};
However, when I try to access a view that requires the policy the console logs flash is not defined
and my browser shows the view's path as an object.
Here is the code I'm using for the policy:
module.export = function(req, res, next) {
res.locals.flash = {};
if(!req.session.flash) return next();
res.locals.flash = _.clone(req.session.flash);
// clear flash
req.session.flash = {};
next();
};
It seems like there has been a very similar problem posted on here before, in that users case it was because he forgot the apostrophes around "flash" in the config/policies.js
file.
Upvotes: 0
Views: 146
Reputation: 615
Check your policy definition. The code you pasted has "module.export" instead of "module.exports"
Upvotes: 2