This might help you out.
http://www.robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained
Cheers,
Robby
On Fri, Feb 13, 2009 at 3:32 AM, Srinath A.
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> Hi,
> I was wondering how to get subdomain name in my localhost.
> I''m on ubuntu and set domainnames in /etc/hosts like this
>
> 127.0.0.1 : localhost
> 127.0.0.1 : tokyo
> 127.0.0.1 : sub.tokyo
>
> when i was using puts request.domain it was showing "tokyo" when
hit URL
> with http://tokyo:3002 and "sub.tokyo" when hit URL with
> http://sub.tokyo:3002
>
>
> then, how i can i differ subdomains in sub.tokyo
> 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??
>
> thanks,
> sri..
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--
Robby Russell
Chief Evangelist, Partner
PLANET ARGON, LLC
design // development // hosting w/Ruby on Rails
http://planetargon.com/
http://robbyonrails.com/
http://twitter.com/planetargon
aim: planetargon
+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---