Hello I have more than one domain and i want to create different views for each domain. example i have: - domain_A, - domain_b My question is how to create different views for each domain (each domain has its own view)? Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
michal wrote:> Hello > > I have more than one domain and i want to create different views for > each domain. >Just to clarify, are you saying the two domains will go to the same app, with the same database, and do the same thing...but just look different? Or are you essentially talking about two different apps on the two domains, but running on one server? best, jp -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You''ll need to work with request.domain [and possibly the array of request.subdomains] but I can''t tell if you''re talking about forcing wholly different layouts for each domain or merely having some controller methods use different views based on the domain. I can''t imagine a case for the second but that''s what your question sounds like. Clarification?? RSL On 1/11/07, michal <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Hello > > I have more than one domain and i want to create different views for > each domain. > > example i have: > - domain_A, > - domain_b > > My question is how to create different views for each domain (each > domain has its > own view)? > > Thanks > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m saying about one app with one database and more than only one domain. Jeff Pritchard wrote:> michal wrote: >> Hello >> >> I have more than one domain and i want to create different views for >> each domain. >> > > > Just to clarify, are you saying the two domains will go to the same > app, with the same database, and do the same thing...but just look > different? > > Or are you essentially talking about two different apps on the two > domains, but running on one server? > > best, > jp-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m going out on a limb here but I''d use layout "x" if request.domain == "domain-one.com" layout "y" if request.domain == "domain-two.com" for the layouts. (You may choose to use an if/else/end style.) For the views on each method you''ll have to call def some_method # Code missing... render :template => "blah/blah/blah" if request.domain == "domain-one.com" render :template => "bleh/bleh/bleh" if request.domain == "domain-two.com" end or something. I would personally try to find a way to abstract that out as a filter on the actions. Something like after_filter :map_to_view_by_domain private def map_to_view_by_domain case request.domain when "domain-one.com" render :template => "blah/blah/#{action_name}" when "domain-two.com" render :template => "bleh/bleh/#{action_name}" end end I''m not saying that''s valid code or anything but a rough idea. I think it should work but you''ll have to tool around with it. I''m currently logged into Windows [dual boot] and don''t have access to Ruby/Rails. I hope that works. Or at least puts you on the right track. RS: On 1/17/07, Michal <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > > I''m saying about one app with one database and more than only one > domain. > > Jeff Pritchard wrote: > > michal wrote: > >> Hello > >> > >> I have more than one domain and i want to create different views for > >> each domain. > >> > > > > > > Just to clarify, are you saying the two domains will go to the same > > app, with the same database, and do the same thing...but just look > > different? > > > > Or are you essentially talking about two different apps on the two > > domains, but running on one server? > > > > best, > > jp > > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---