Virtual subdomains?

I have an application where many subdomains will exist depending upon
geographic location (location1.example.com and location2.example.com),
but all subdomains will use the same code, only have different data.
Is there a way to handle subdomains virtually with RoR or will it be
necessary to copy the same code to each hard coded subdomain?

On 27 Feb 2007, at 03:40, Tony K. wrote:

I have an application where many subdomains will exist depending upon
geographic location (location1.example.com and location2.example.com),
but all subdomains will use the same code, only have different data.
Is there a way to handle subdomains virtually with RoR or will it be
necessary to copy the same code to each hard coded subdomain?

The account_location plugin (http://dev.rubyonrails.org/svn/rails/
plugins/account_location/) will help you out for your subdomain
handling, I’m using it in almost all my apps. Then you’ll need to use
a wildcard DNS entry so that the nameserver will pass any url
belonging to the domain to your rails webserver (*.mydomain.com).

There are a few way to go at this:

  1. Keep all your data in one database and filter out the data for
    your each of the locations
  2. Use the location to set the database connection in your
    application controller so that you can use a separate database for
    each customer

Best regards

Peter De Berdt