Not able to recognize helper class method in controller!

Hi,

Not able to recognize helper class method in controller!

When I try to call some method “get_formatted()” in my controller, it
says local method not recognized.

Please help me out.

Thanks,
josua

joshua asem wrote:

Hi,

Not able to recognize helper class method in controller!

When I try to call some method “get_formatted()” in my controller, it
says local method not recognized.

Please help me out.

Thanks,
josua

Hi, by default helpers are for views. You could probably include the
module manually, but thats not really what they’re for.

A.

Hi,

When I tried accessing in controller like this :
MyHelper::get_team_leve_report

I got the same problem.

Just help me out in making my controller to transfer some of my code to
the helper class.

Thanks,
joshua

helpers are for views. If you need to move code out of the controller,
ask
these questions:

  1. Is it used in all controllers?
    if yes then put it in application.rb
  2. Is it related to formatting data?
    if yes, consider formatting the data in the view instead of the
    controller
  3. Is it manipulating or doing complex business logic?
    if yes, it should be in the model.

Controllers should really only contain flow logic… basically, receive
and
route user requests.