Re: get server url

Bob Showalter
Wed, 03 Oct 2007 15:11:22 -0000

On 10/3/07, Tarscher <tarscher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
> Hi all,
>
> How do i get the server url? Much like the PHP function
> $_SERVER["REQUEST_URI"]

You can get it your controller through

   request.request_uri

or in your view through

   controller.request.request_uri

All the CGI-style variables are available through request.env as well,
so this works:

   request.env[''REQUEST_URI'']

But I wonder why you want it? You normally work with the Rails routing
system and don''t deal with the details of the request URI. What are
you trying to accomplish?