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.

Philidor
  • 40,933
  • 9
  • 84
  • 94
  • 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,781
  • 11
  • 21