Hi,
we are currently developing a rails application that should be able to
use different templates/layouts for i18n reasons and to be able to do
customized versions for different customers/partners.
So the idea is, that there is one request, that is chooses one template
set depending on the logged in user or something like that.
For templates I found, that I can implement such logic by overwriting
the default_template_name method in the ApplicationController class and
do something like
def default_template_name(default_action_name = action_name)
lang = session[:language] ? session[:language] : "en"
"#{lang}/#{self.class.controller_path}/#{default_action_name}"
end
for a language dependent choice (given that the language is defined in
the session).
The templates are read from <language>/controller in this case.
However I didn''t find a similar method for choosing the layout files.
Is there any way to modify the process of choosing the layout for some
controller (except setting the layout explicitly in each method)?
That is, modify the logic for the default layout to choose
<some token>/layout/<controller>.rhtml or <some
token>/layout/application.rhtml instead of
layout/<controller>.rhtml or layout/application.rhtml
Thanks for any hints
Morus