Reputation: 33954
It's easy, and common, to redirect to :back in Rails.
However, how do I access the actual URL stored, or represented by ":back"?
Upvotes: 0
Views: 1083
Reputation: 51697
Rails uses request.headers["Referer"]
and raises an error if it's nil.
Source:
https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/redirecting.rb#L87
Upvotes: 2
Reputation: 11278
request.env['HTTP_REFERER'] in your controller, but be aware, that this can always be nil
Upvotes: 4