[Rails] Re: Common action for all the controllers.

2009-02-12 Thread Ar Chron
> If you have any alternate solution, please provide. I didn't go the plugin route in our application, but opted for a form of "behavior by convention" class GenericController < ApplicationController # here's the standard index method def index blah blah blah end # here's a new com

[Rails] Re: Common action for all the controllers.

2009-02-12 Thread MaD
sorry, just checked it. i gotta be like this: # my_plugin.rb: module MyPlugin def self.included(base) base.extend(ClassMethods) end module ClassMethods def my_action # ... end end end irb(MyOtherController):001:0> MyOtherController.methods.include

[Rails] Re: Common action for all the controllers.

2009-02-12 Thread MaD
that's right, but you didn't mention you were trying to write a plugin. in that case try to write it like this: # my_plugin.rb: module MyPlugin def my_action end end # init.rb: ActionController::Base.send :include, MyPlugin hope i didn't forget anything. --~--~-~--~~

[Rails] Re: Common action for all the controllers.

2009-02-12 Thread Siddick Ebramsha
MaD wrote: > maybe i'm completely confused about what you're trying to do, but > application-controller says the following: > # Filters added to this controller apply to all controllers in the > application. > # Likewise, all the methods added will be available for all > controllers. From plug

[Rails] Re: Common action for all the controllers.

2009-02-12 Thread MaD
maybe i'm completely confused about what you're trying to do, but application-controller says the following: # Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. --~--~-~--~~---