Subdomain


#1

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


#2

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


#3

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


#4

“David” removed_email_address@domain.invalid wrote in message
news:removed_email_address@domain.invalid…
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”