Hello

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|
        redirect_to :back
  end

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:
def after_sign_in_path_for(resource)
stored_location_for(resource)
end

It would be perfect if I could combine them.


Thank you!

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to