Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: address server
Frederic Jean
1/2/2007 8:00:00 PM
I'm going to make the assumption that we are talking about a Rails app. The
easiest way I found was to call request.host_with_port within a controller
or a view. This will return the host name and the port number (if provided).
I use this approach to figure out which Google Maps api key to use in my
application (one for development work, another one for the "production"
site).
There is a very active mailing list for Ruby on Rails. You can get details
on how to subscribe by going to
http://groups.google.com/group/rubyonrails-...
.
Hope this helps.
Fred
On 1/2/07 7:15 AM, "marco" <marco.burlando@gmail.com> wrote:
> In a web application
>
> On Jan 2, 2:34 pm, Robert Klemme <shortcut...@googlemail.com> wrote:
>> On 02.01.2007 14:19, marco wrote:
>>
>>> Do you know a method for find address of the server ?
>>> I have to do an "if" to find if I am in localhost:3000 or in
>>> mydomain.comIn what kind of application?
>>
>> robert
>
>
--
Frederic Jean
fred@fredjean.net
http://typo.fre...
1 Answer
marco
1/3/2007 11:44:00 AM
0
Frederic Jean wrote:
> I'm going to make the assumption that we are talking about a Rails app. The
> easiest way I found was to call request.host_with_port within a controller
> or a view. This will return the host name and the port number (if provided).
>
> I use this approach to figure out which Google Maps api key to use in my
> application (one for development work, another one for the "production"
> site).
Me too. This was my trouble.
>
> There is a very active mailing list for Ruby on Rails. You can get details
> on how to subscribe by going to
>
http://groups.google.com/group/rubyonrails-...
.
>
> Hope this helps.
>
> Fred
>
I find this method "request.env" who return a hash of all information :
request.env["SERVER_NAME"] and ["SERVER_PORT"]
Thank for your helps
Marco
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: address server
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password