[Plugin dev.] Hook into ActionController::Base properly

Wer Sie
2009-06-20T19:41:40Z

Hi all,

currently I''m developing a plugin wich shoud hook into
ActionController.
To do that, I''m using ActionController::Base.send(:include, ...) but
when I want to call the according methods from within a controller, I
get an MethodNotError.

The following code shows what I''m currently trying. Mixing the
ViewHelpers into ActionView::Base work''s fine. The same I want to do
with ActionController:Base, but that does''n work:

[code]
#require ''widget_pool/loader''
require ''widget_pool/view_helpers''
require ''widget_pool/base''

module WidgetPool

  module Loader
    def load_widget name
      puts ''loading widget: '' + name.to_s
    end
  end

  class << self
    def enable
      puts ''starting widget_pool...''

      ActionView::Base.send :include, ViewHelpers
      ActionController::Base.send :include, Loader
    end
  end
end

WidgetPool.enable
[/code]

Does anybody know, what is missing to make it work?

Thanks & Greetings