Forum: Ruby on Rails get subdomain in localhost

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Srinath A. (Guest)
on 2009-02-13 13:32
I was wondering how to get subdomain name in my localhost.
I'm on ubuntu and set domainnames in /etc/hosts like this : localhost : tokyo :

when i was using puts request.domain it was showing "tokyo" when hit URL
with http://tokyo:3002 and "" when hit URL with

then, how i can i differ subdomains in
i tried using request.subdomains.first, but showing nil in localhost

Finaly i was looking for these when used
 puts request.domain.inspect
 ===>  "localhost" or "tokyo"
 puts request.subdomains.first
 ===> "sub"

any help??

Robby R. (Guest)
on 2009-02-13 16:26
(Received via mailing list)
This might help you out.


On Fri, Feb 13, 2009 at 3:32 AM, Srinath A.
<removed_email_address@domain.invalid> wrote:
> with http://tokyo:3002 and "" when hit URL with
>  ===> "sub"
> any help??
> thanks,
> sri..
> --
> Posted via
> >

Robby R.
Chief Evangelist, Partner

design // development // hosting w/Ruby on Rails
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]
This topic is locked and can not be replied to.