You have a couple of options.

1. Setup virtual hosts on your web server and find a way to keep the
public folders seperate(easy in passenger on apache, but cannot speak
for anything else).  This does not allow for having seperate view
files for each subdomain.

2. In addition to or instead of 1, use the code below in your
application controller and call it before every request with the theme
for that request (i.e. get it from the params in one way or another -
I use a database lookup as my sites are defined in the db, but that is
not nescessary unless you require it for another reason).
Note that the code below will expect the different views in a folder
called 'themes/<<theme>>/views' - change this to wherever you want to
store it.
The good thing about this method is that it uses rails to do the
clever stuff and if the view file that you want isn't in the folder
specified, then it will look in existing locations i.e. your
application.  This is useful if you want all of your subdomains to
keep the same view files as the app UNLESS you want to change them for
that subdomain.

          def set_theme(theme)
            @theme=theme
            Thread.current[:current_theme]=theme

            prepend_view_path([
                    ::ActionView::ReloadableTemplate::ReloadablePath.new
(Rails::public_path + "/themes/#...@theme}/views")])
          end


Regards

Gary

On Jan 24, 4:24 pm, eugenio <eugenio.mode...@gmail.com> wrote:
> what is the easiest way to achieve that result?
> i would like to keep controllers and models the same for all the
> "applications", which, in fact, are the same. They only appear
> different (the views, the css, and a parameter of the query that will
> be sent to the database).
> I could separate the rails app, but, doing that, i will need to
> replicate every common change (a bug fix in a model method for
> example) to all of them. is there a better way?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to