SOLVED: How to add existing helper in an extended controller (Redmine Plugin Dev)
Can anyone guide me through the right way to add an existing Helper into an extended controller which previously did not contain this helper.
For example, I have extended the timelog_controller.rb controller in timelog_controller_patch.rb. Then, I tried to add the helper Queries, which brings some functionality that I want to use in my patch.
If I add the helper in my patch (my timelog extended control), I always get the same error:
Error: uninitialized constant Rails:: Plugin:: TimelogControllerPatch (NameError)
Here is an example of how I have done:
module TimelogControllerPatch def self.included(base) base.send(:include, InstanceMethods) base.class_eval do alias_method_chain :index, :filters end end module InstanceMethods # Here, I include helper like this (I've noticed how the other controllers do it) helper :queries include QueriesHelper def index_with_filters # ... # do stuff # ... end end # module end # module patch
However, when I include the same helper in the original controller, everything works fine (of course, this is not the right way).
Could someone tell me what am I doing wrong?
Thanks in advance :)
RE: How to add existing helper in an extended controller (Redmine Plugin Dev) - Added by Dan A. S. about 6 years ago
This question has been solved here:
Thanks to Eric Davis!