Re: get server url

Tarscher
Wed, 03 Oct 2007 15:17:25 -0000

Many thanks for the fast reply.

The  request.env[''REQUEST_URI'']  only returns the path eg:
http://localhost:3000/user I get /user . Iactually want http://localhost:3000/
I can do this via request.protocol()+request.request_uri() but I
wonder if there is a single method that can do this.

I need this for mail sending. I''m creating a user activation system
that wan run on multiple domains. When I send out a mail the user has
to click alink to activate it. Ofcourse this link is dependant on the
domain the site is hosted on.

Regards,
Stijn

On 3 okt, 17:11, "Bob Showalter"
<showa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> On 10/3/07, Tarscher
<tarsc...-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?