Hi,
I have a module with a helper method in it. I want to automatically
declare the method as a helper when I mix the module into a controller
class, so the mixin basically sets itself up. Something like :-
module MyMixin
I want to do helper method here in the module
helper_method :my_helper
def my_helper
puts “foo”
end
end
class MyController < ApplicationController
include MyMixin
I dont’ want to have to do helper_method in the controller
helper_method :my_helper
This does not work as I want, I have to do “helper_method” in the
controller class itself. If I try to do it in the module I get an error
like this :-
undefined method helper method
for MyMixin:Module
Is there a way to achieve this?