Hi people
I want to know if it is possible to call an action that belongs to a
controller from another action that belongs to a different controller.
I have the "search" action in the controller of Model A , and I need
to cal that action from the action "register", but action "register"
belongs to the controler of Model B. Also I need to pass some
parameters from action register to execute action search
Is that possible?
create a module and move that method here. then just include into your controllers and use
tom
I've start reading about modules, and it seems to be what I need
Thanks for your help
just create my_module.rb in lib/
module MyModule
def my_method
…
end
end
and in your controller just
class MyController < ApplicationController
include MyModule
def search
my_method(params)
end
end
just check whether your module is loaded or add require to your config/environment.rb file
tom