Prepend_view_path and layouts


#1

When using prepend_view_path in a before_filter in
application_controller it renders all views correctly from the added
view path. However layouts are still from the default location…

Any ideas?


#2

It seems that there are 2 different view_paths used:

  • The class one… (is the only one used on layouts)
  • The instance one… (is used on other views)

So when theming your whole application you have to do something like:

  self.class.prepend_view_path("#{RAILS_ROOT}/themes/#

{self.current_theme}/views") # This is for the layouts :S
self.prepend_view_path("#{RAILS_ROOT}/themes/#
{self.class.current_theme}/views") # This is for the actions

This probably isn’t thread safe, etc…etc…

But WHY is Rails using 2 DIFFERENT view_paths ??