3

I am attempting to add a new module of custom helpers to the ActionView::Base library. I was able to get the module to load from the config/initializers directory but when I load it into the lib, the module is no longer found. I have:

# lib/my_templates/helper.rb
module MyTemplates
  module Helper
    def print_me
      return 'me'
    end
  end
end

ActionView::Base.send(:include, AtlasTemplates::Helper)

In the application.rb

config.autoload_paths += Dir["#{config.root}/lib", "#{config.root}/lib/**/"]

If I put helper.rb into the config/initializers then <%= print_me -%> works just fine. If I move it to it's lib location then I get undefined local variable or methodprint_me'`

I am definitely missing something here.

Jeremy B.
  • 9,168
  • 3
  • 45
  • 57

0 Answers0