I'm working to implement CanCan. For some reason CanCan keeps giving me Access Denied when I try to get specific about model permissions. And I can't figure out why.
Is there a way to get CanCan to be specific, perhaps in the logs or in development about Why Access is denied? something like, No Read Ability to XXX Model.
That would be helpful for debugging.
Thanks
You can add a rescue_from
block in ApplicationController to handle CanCan exceptions and set your custom error message there. See the CanCan docs for a detailed explanation.
You can add some output in your Ability model and check after what can or cannot your ability failed.
Or you can add a debugger session in start of you ability class.
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