0

I want to create a module in /lib folder & access that form my controllers. There are several solutions available in different websites, but modules are not loading.

Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103
  • possible duplicate of [Auto-loading lib files in Rails 4](http://stackoverflow.com/questions/19098663/auto-loading-lib-files-in-rails-4) – Eyeslandic Jul 28 '14 at 13:31

1 Answers1

1

You need to add:

config.autoload_paths += %W(#{config.root}/lib)

to your config/application.rb

And then:

require 'file_name'

in your controller. That works for me (Rails 4).

Grych
  • 2,861
  • 13
  • 22