get subdomain in localhost

Hi, 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??

thanks, sri..

This might help you out.

Cheers, Robby