Lon Baker wrote:> Is it possible to set the path to a completely different set of views
> for controllers during login? I know how to alternate the layouts but
> can I change the path to the views completely?
>
> The goal is to allow for a different "view" for mobile users
versus
> desktop users.
class ApplicationController < ActionController::Base
before_filter :choose_template_root
private
def choose_template_root
case view = @params[''view'']
when ''wap'', ''googlebot'',
''rss''
self.class.template_root = "#{RAILS_ROOT}/app/#{view}_views/"
else
# Bad or missing view param. Fall back to default template
# root directory: RAILS_ROOT/app/views/
end
end
end
jeremy