It looks like you cannot use a helper in a controller even if both of them belong to the same class. For example: XYZHelper and XYZController…
I was under the impression that if the prefix is the same “XYZ” then the method in the helper can be used in the controller and in the view, but I think this is not the case.
So how do I remove some common functionality from a controller and place it in a helper. I want to place that piece of code in a helper because other controllers may be using it. What is the best way to approach this.
Thanks,
Jai.
Follow
Pete‘s guidelines. If you still need to expose the methods then do the following:Add the methods to
ApplicationControllerclass and register the methods as helper methods by callinghelper_method.