I have a rails 3 app and I am trying to implement the redirect back
action at access denied for cancan.
If I try this in my application_controller:
rescue_from CanCan::AccessDenied do |exception|
It gives the following error:
No HTTP_REFERER was set in the request to this action, so
redirect_to :back could not be called successfully. If this is a test,
make sure to specify request.env[“HTTP_REFERER”].
I can’t really understand why there is no http_referer, how is back
button working on views? Is it possible to implement a general back
action for the cancan access denied exception?
I like the devise approach of “back” method after sign in:
It would be perfect if I could combine them.