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
on 2007-03-13 22:03
on 2007-03-14 09:44
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
on 2007-04-01 22:20
Hallo Timo Did you found any other solution to this issue? I just want to create a controller class into my plugin, in order to call it directly from browser. But I don't get it running. Thanks.