views:

14

answers:

1

Hi,

I am writing my first ever plugin for rails. The plugin is supposed to extend the actioncontroller::base

so after going through the tutorials here is what i did...

# Foo
class << ActionController::Base
  def function_name

assuming the plugin is called foo... but when i call function_name from an action, nothing happens... It seems the function_name is not even called. there is no method missing error either so i am sure the plugin has been loaded too...

m stuck real bad!

+1  A: 

You need include a class to ActionController.

module Foo
  def function_name
  end
end

ActionController::Base.send(:include, Foo)
shingara