Add comment

Nov 15 2007
User: cedric
Category: Ruby on Rails
Tags: code Rails2

view_paths lookup for themes

After the release of Rails 2.0 RC1 I’m trying to have a kind of “theme support” working by using view_paths.

I’m using in my application controller

<pre> def get_theme @settings=session[:loadedsettings] @style=@settings.theme.nil? ? "default": @settings.theme self.view_paths[0]="#{RAILS_ROOT}/themes/#{@style}" self.view_paths[1]="#{RAILS_ROOT}/themes/#{@style}/views" self.view_paths[2]="#{RAILS_ROOT}/app/views" return @style end </pre>

it works by having layout :get_theme in my controllers and to have “style”.html.erb in the good directory but when using partials it renders the normal template using /app/views and not the one in the dedicated directory, I need to test gain to find my answer.

comments : 0 Add comment




Back
Log in

Quick links

Themes

Localization

Search

weather


  • metric us

gallery

  •  
    IMG_2091.JPG
     

Flickr

Last comments

  • no new comments

Categories

  • categories

nabaztag

  • message

    left
    right
    voice
    speed
    pitch

hcard