method

append_view_path

Importance_2
v2.2.1 - Show latest stable - 1 note - Class: ActionController::Base
append_view_path(path) public

Adds a view_path to the end of the view_paths array. If the current class has no view paths, copy them from the superclass. This change will be visible for all future requests.

  ArticleController.append_view_path("views/default")
  ArticleController.append_view_path(["views/default", "views/custom"])
Show source
Register or log in to add new notes.
June 26, 2008
8 thanks

Handy for adding theme support

I’m using this to add basic theme support to my app:

append_view_path(File.join(RAILS_ROOT, "app/themes/#{@current_theme}"))
append_view_path(File.join(RAILS_ROOT, 'app/themes/_base'))

Common templates go in app/themes/_base and then you can override these with specific theme versions in each theme directory.