# Prepend\_view\_path and layouts

**URL:** <https://www.ruby-forum.com/t/prepend-view-path-and-layouts/159632>\
**Category:** Rails\
**Created:** [February 6, 2009, 3:23pm UTC](https://www.ruby-forum.com/t/prepend-view-path-and-layouts/159632 "2009-02-06T15:23:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6de8d8/32.png) [@joost](https://www.ruby-forum.com/u/joost)\
**Post date:** [February 6, 2009, 3:23pm UTC](https://www.ruby-forum.com/t/prepend-view-path-and-layouts/159632/1 "2009-02-06T15:23:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![joost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6de8d8/32.png) [@joost](https://www.ruby-forum.com/u/joost)\
**Post date:** [February 9, 2009, 10:19am UTC](https://www.ruby-forum.com/t/prepend-view-path-and-layouts/159632/2 "2009-02-09T10:19:20Z")

</div>

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 ??
