I've installed the gem Pundit in my Rails app, and have followed the instructions in the README carefully.
However, when I use authorize in any of my controllers, I get the error message "undefined method 'authorize' for .
Also, when I try to use "policy" in a view, I get the error "undefined method 'policy'".
It's as if Pundit weren't installed at all!
I've included Pundit in my Application Controller.
I have an ApplicationPolicy file with all of my policies, then policy files for each type of record that inherit from the Application Policy.
For some reason, I can't paste any of my code into this question, so I'm hoping I've included enough information!
I'd appreciate any thoughts.
I have recently used pundit and it worked like a charm. your error messages makes me infer that you've not run install rails g pundit:install or your policies file are not in correct directories.
or if they are then Just restarting the server should fix this. Hopefully.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With