Adding actions/methods to a controller via a plugin

Hi,

I would like to develop a plugin, that if enabled in a controller, extends the controller with some basic methods (actions).

Here's what I've done so far: In init.rb:

require 'my_scaffold' ActionController::Base.send :include, MyScaffold

in lib/my_scaffold.rb:

module MyScaffold     def foo       render :text => "Hello World"     end end

But everytime I try to access this new action "foo" I get an "Unknown Action" error from rails.

What am I missing?

Timo

Hi,

after some more tests the problem seems to be with defining methods as public:

in lib/my_scaffold.rb:

module MyScaffold     def foo       render :text => "Hello World"     end end

Calling foo from another methode, i.e. "index" the text "Hello World" is rendered:

class MyController < ApplicationController   def index     foo   end end

Seems like the added methode "foo" isn't a public methode. So, how do I define the foo-methode as public?

Regards, Timo