Subdomain

I know how to retrieve the current :controller and :action, but is there
a
variable available for me to retrieve the URL items such as:

subdomain.mydomain.com

I would like to be able to pull “subdomain” out of the URL. Is this
possible with something built-in?

Thanks,
David

David wrote:

I would like to be able to pull “subdomain” out of the URL. Is this
possible with something built-in?

http://weblog.rubyonrails.org/articles/2006/05/22/dan-webbs-request-routing-plugin

You might want to look into acts_as_subdomainable :slight_smile: Just kidding,
but you might look into this plugin:

http://www.agilewebdevelopment.com/plugins/account_location

It probably has the goods to get you going.

Michael

“David” [email protected] wrote in message
news:[email protected]
I know how to retrieve the current :controller and :action, but is there
a
variable available for me to retrieve the URL items such as:

subdomain.mydomain.com

@request.subdomains will give you an array of all the subdomains. In the
example you gave, @request.subdomains.first would return “subdomain”