aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-11-26 03:59:23 +0000
committerRick Olson <technoweenie@gmail.com>2007-11-26 03:59:23 +0000
commit87e506da535118d77b58484a4e6e2d1cd9e13b53 (patch)
treefc80941c104799d584838ba8cc3b7954171d0e72 /actionpack/lib/action_controller
parent1af084ecda66a8e1b4eb3a51a07ebca85bf2e419 (diff)
downloadrails-87e506da535118d77b58484a4e6e2d1cd9e13b53.tar.gz
rails-87e506da535118d77b58484a4e6e2d1cd9e13b53.tar.bz2
rails-87e506da535118d77b58484a4e6e2d1cd9e13b53.zip
Add #prepend_view_path and #append_view_path instance methods on ActionController::Base for consistency with the class methods. [rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8214 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rwxr-xr-xactionpack/lib/action_controller/base.rb25
1 files changed, 22 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 5249fd035a..9b77f0fb55 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -430,7 +430,7 @@ module ActionController #:nodoc:
# Adds a view_path to the front of the view_paths array.
# If the current class has no view paths, copy them from
- # the superclass
+ # the superclass. This change will be visible for all future requests.
#
# ArticleController.prepend_view_path("views/default")
# ArticleController.prepend_view_path(["views/default", "views/custom"])
@@ -442,7 +442,7 @@ module ActionController #:nodoc:
# 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
+ # 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"])
@@ -636,7 +636,6 @@ module ActionController #:nodoc:
request.session_options && request.session_options[:disabled] != false
end
-
self.view_paths = []
# View load paths for controller.
@@ -647,7 +646,27 @@ module ActionController #:nodoc:
def view_paths=(value)
(@template || self.class).view_paths = value
end
+
+ # Adds a view_path to the front of the view_paths array.
+ # This change affects the current request only.
+ #
+ # self.prepend_view_path("views/default")
+ # self.prepend_view_path(["views/default", "views/custom"])
+ #
+ def prepend_view_path(path)
+ (@template || self.class).prepend_view_path(path)
+ end
+ # Adds a view_path to the end of the view_paths array.
+ # This change affects the current request only.
+ #
+ # self.append_view_path("views/default")
+ # self.append_view_path(["views/default", "views/custom"])
+ #
+ def append_view_path(path)
+ (@template || self.class).append_view_path(path)
+ end
+
protected
# Renders the content that will be returned to the browser as the response body.
#