A kind of monkey patch and an invitation for criticism for all you (who know this stuff better than I do)

I've often felt the need including Rails' view helpers within my
controllers, if only for some simple things like formatting my flash
notices with text helpers or html escaping. I loved this suggestion,
which helps by not cluttering the namespace of controllers:


But I wanted to generalize this a little to automatically include
whatever helper modules are included in the views. So I dreamt up 35
lines of goodness:

class Object
  def metaclass; class << self; self; end; end

module ActionController
  class Base
    class_inheritable_accessor :controller_helper_module
    class_inheritable_accessor :controller_helper_object
    self.controller_helper_module = Module.new
    self.controller_helper_object = Object.new

    class << self
      def add_template_helper_with_controller_helper(helper_module)
        self.controller_helper_module.send(:include, helper_module)
      alias_method_chain :add_template_helper, :controller_helper

      def inherited_with_controller_helper(child)
        child.controller_helper_module.send :include,
      alias_method_chain :inherited, :controller_helper

      def recreate_controller_helper_object
        self.controller_helper_object = Object.new


    def help