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.
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.