Different view for different subdomains in Rails -
i building rails application need usability test of 3 different views same application. thought switch out default view path depending on subdomain.
for example, i'd able define paths like:
option1.mysite.com => views/option_1 option2.mysite.com => views/option_2 option3.mysite.com => views/option_3
i'd keep models , controllers same, switch out views depending on subdomain. might best way this?
we this:
session[:site] = case request.subdomains.last when "a" "a" when "b" "b" when "c" "c" end
that's part of set_site
method in our application controller. every request checks see if session[:site]
set; if not, calls set_site
set it.
in case, need introduce logic in views present things differently depending on value of session[:site]
, it's better if actual view html same , major difference in css. load different css files depending on value of session[:site]
.
Comments
Post a Comment