Rails 3 Does Not Auto-Load Classes/Modules From "/lib" Folder
September 15, 2010 / Jigar Patel
In Rails 3 classes and modules from “/lib” folder are not automatically loaded. If you create any module/class in lib folder and try to use it, the server will throw an “uninitialized constant XYZ (NameError)”.
The change is deliberate and there is a configuration setting in application.rb to specify the folders which are to be auto loaded.
Uncomment these lines and modify the path to
This will autoload all the classes and modules in the “/lib” folder.