From 66ef92272c5d6519b425e73e500bbae1a75b348e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 26 Aug 2010 16:03:10 -0300 Subject: 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. --- actionpack/lib/abstract_controller/helpers.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionpack/lib/abstract_controller/helpers.rb') 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. -- cgit v1.2.3