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.
on 2007-05-21 04:14
on 2007-05-21 04:30
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.
on 2007-05-21 04:37
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.