How to get the current URL?

Hi,

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.


\ / [email protected]
/lad http://www.hashbang.de

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…?

“Vlad Berditchevskiy” [email protected] wrote
in message news:[email protected]

Hi,

how can I get the current URL withing a controller?

Hi Vlad

I use @request.request_uri

“Alan B.” [email protected] writes:

I use @request.request_uri

Thank you - works perfectly!


\ / [email protected]
/lad http://www.hashbang.de