$_SERVER for rails?

Is there something similar for rails that is like $_SERVER in PHP?
Something that gives you the hostname, etc. I tried using just host in
my controller, because the documentation says there is a host method,
and got an undefined method error.

Is there something similar for rails that is like $_SERVER in PHP?
Something that gives you the hostname, etc. I tried using just host in
my controller, because the documentation says there is a host method,
and got an undefined method error.

Try request.host

See
http://api.rubyonrails.com/classes/ActionController/AbstractRequest.html

Regards,
Rimantas

http://rimantas.com/

On 31-Aug-06, at 9:51 AM, Ben J. wrote:

Is there something similar for rails that is like $_SERVER in PHP?
Something that gives you the hostname, etc. I tried using just host in
my controller, because the documentation says there is a host method,
and got an undefined method error.

The request object responds to ‘host’ and others. Try this in your
controller:

request.host

See here for more:
http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html

/Jeff


http://re.visioni.st
http://quotedprintable.com