aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/helpers.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-08-26 16:03:10 -0300
committerJosé Valim <jose.valim@gmail.com>2010-08-26 16:07:54 -0300
commit66ef92272c5d6519b425e73e500bbae1a75b348e (patch)
tree8946ded090a491037bf6fc4150708baf5b48154d /actionpack/lib/abstract_controller/helpers.rb
parent84cab320bc1faaddc142cbbb38713d3f29a8b07d (diff)
downloadrails-66ef92272c5d6519b425e73e500bbae1a75b348e.tar.gz
rails-66ef92272c5d6519b425e73e500bbae1a75b348e.tar.bz2
rails-66ef92272c5d6519b425e73e500bbae1a75b348e.zip
Add clear_helpers as a way to clean up all helpers added to this controller, maintaing just the helper with the same name as the controller.
Diffstat (limited to 'actionpack/lib/abstract_controller/helpers.rb')
-rw-r--r--actionpack/lib/abstract_controller/helpers.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb
index 0c96a6ed15..a0ce121ade 100644
--- a/actionpack/lib/abstract_controller/helpers.rb
+++ b/actionpack/lib/abstract_controller/helpers.rb
@@ -95,6 +95,13 @@ module AbstractController
_helpers.module_eval(&block) if block_given?
end
+ # Clears up all existing helpers in this class, only keeping the helper
+ # with the same name as this class.
+ def clear_helpers
+ self._helpers = Module.new
+ default_helper_module! unless anonymous?
+ end
+
private
# Makes all the (instance) methods in the helper module available to templates
# rendered through this controller.