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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Timo Springmann
2007-Mar-14 08:44 UTC
Re: Adding actions/methods to a controller via a plugin
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 > endCalling 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Franco Sellitto
2007-Apr-01 20:20 UTC
Re: Adding actions/methods to a controller via a plugin
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---