How can a running Rails application tell what port it''s listening on? Say I start the app with ''mongrel_rails -p 3002'' and want a page to say "I''m listening on 3002", how would I do that? -- Nick --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html#M000247 In your controller: request.port There''s also: request.host => "localhost" request.host_with_port => "localhost:3000" Jason On 4/27/07, nick-ju2ih3z2s7NWk0Htik3J/w@public.gmane.org <nick-ju2ih3z2s7NWk0Htik3J/w@public.gmane.org> wrote:> > > How can a running Rails application tell what port it''s listening on? > Say I start the app with ''mongrel_rails -p 3002'' and want a page to say > "I''m listening on 3002", how would I do that? > -- > Nick > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
nick-ju2ih3z2s7NWk0Htik3J/w@public.gmane.org
2007-Apr-27 18:01 UTC
Re: Finding out the port
On 2007-04-27 13:42, Jason Roelofs wrote:> http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html# > M000247 > > In your controller: > > request.portThank you. I realised I should have asked a different question. Is there a way to get at the port number independently of a specific request? For example, if I want to set something in environment.rb in a way that depends on the port number. -- Nick --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---