[Rails] How to get the current URL?

Philip Hallstrom
2006-07-12T17:14:10Z

> how can I get the current URL withing a controller? There seems to be no
> appropriate method in ActionController::Base.
>
> I''m creating a site, which requires a login for some pages.
I''m using
> before_filter for authentication. My idea was to store the currect URL
> in a session before redirecting to the login page and then redirect to
> this URL after successful authenfication. But how do I get the current
> URL? I could store controller_name, action_name and params[] in the
> session, and then construct the URL by calling url_for. But has it
> really to be that complicated? All I need is the full URL.

Dig through ''request''... something like
request.env[''REQUEST_URI'']
maybe...?