I need to define some common piece of code that can be invoked from different controllers(not view). Is there a way to do that in Rails v3?
I have defined the code in ApplicationHelper and tried to invoke it using
@template.<helper_method>
and
ActionController::Base.helpers.<helper_method>
But it does not work?
Code that you will invoke in controllers can be defined as protected methods in their parent,
ApplicationController.app/controllers/application_controller.rb:
app/controllers/users_controller.rb: