Multisite in Rails 3

I need to develop Rails 3 application with a single codebase
(controlers, models, helpers, etc), but with different views support.
For example if I open www.site1.com my Rails 3 app loads views
and layouts for site1, if I open www.site2.com it loads views and
layouts
for site2. So both sites have the same functionality, but looks
differently.

What is the best way to implement this functionality in Rails 3.

Thank you in advance.

It shouldn’t be that much different from what you can find at http://railscasts.com/episodes/123-subdomains

Also look at http://stackoverflow.com/questions/2308903/support-for-multiple-domains-subdomains-in-rails


Ramon Tayag

Depends what you mean by functionality. If all the sites use the same
database, you could for example set up Apache to direct all requests
to the default server and use request.env['HTTP_HOST'] to set up a
session variable the layout can use to assign the correct style sheet
or what menus are available or whatever.