Forum: Ruby on Rails Different views for different sites from same codebase?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rm R. (Guest)
on 2007-05-21 04:14
I need to develop an application which will have one codebase but
different sites will be accessing the same codebase. Now the problem is
that how can render different look and feel for the same view based on
the site the request came from. For eg. if request came from www.a.com
then all the screens will have the same functionality but differnt look
then the request from www.b.com. I can figure out the domain from where
the request came, but don't know how to setup the base for the view
based on domain. Basically , I want one code base i.e. one set of
controllers but n sets of views for each method if I am serving n sites.

Any help is greatly appreciated.
dasil003 (Guest)
on 2007-05-21 04:30
(Received via mailing list)
Check out theme_support from Matt McCray (http://mattmccray.com/).
He's been MIA and you will need to patch it to work with Rails 1.2.

The plugin is basically extracted from Typo themes, so it has some
limitations.  Basically it lets you override any template from an
application.  So you can probably accomplish what you are looking for
just by dropping in a new layout, and creating some wrapper code to
select the theme based on the domain name.  I am currently using it
for a major product, and have submitted a couple patches to Matt but
heard nothing back.  I'm thinking about creating a derivative plugin
called "multisite" or something that is specifically focused on what
you're asking.
Sean T Allen (Guest)
on 2007-05-21 04:37
(Received via mailing list)
There is the productize code as well.

Technically not compat. with Rails 1.0 but there is this:

http://cwilliams.textdriven.com/articles/2006/02/1...

that has working code for that.
This topic is locked and can not be replied to.