Forum: Ruby on Rails prepend_view_path and layouts

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B0a417a921e705ad0a605ff666d9b074?d=identicon&s=25 Joost (Guest)
on 2009-02-06 15:23
(Received via mailing list)
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?
B0a417a921e705ad0a605ff666d9b074?d=identicon&s=25 Joost (Guest)
on 2009-02-09 10:19
(Received via mailing list)
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 ??
This topic is locked and can not be replied to.