by default, when i ask rails controller to do messages/index, he does
def index
respond_to{|fmt| fmt.html}
end
and shows app/views/messages/index.html.erb
there is a customer which wants his instance of the platform to display views differently (and changes cannot be done with css only).
solution i think of would be
create directory app/views/#{customername}, which would have same structure as app/views, but would only have views which have to override default ones.
setting an array constant containing list of views which have to be overriden (if not, they should load the default views)
CUSTOM_VIEWS["messages"]=["index","show","edit"]
somewhere in the customer-specific config file
in all controller actions do something like
def index respond_to do |fmt| fmt.html do if CUSTOM_VIEWS[params[:controller]].include?(params[:action]) #override default app/views/messages/index.html.erb with app/views/customername/messages/index.html.erb render "#{customername}/#{params[:controller]}/#{params[:action]}" end end end end
or is there better/faster solution/plugin to do that?