How do I include module into ActionView from the lib directory?

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.

Answers


Need Your Help

Will importing SSL certificates for iOS push notifications prevent other developers from working on the project?

ios git push-notification ssl-certificate

I'm implementing push notifications in my iOS app, and as the primary developer, the completed app will be put on my account. However, there is another developer working on this app via GitHub, and...

Parsing Phone Numbers to their parts

c# .net formatting

I know about the C# port of the Google libphonenumber Parsing Library:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.