Autoloading of modules/classes from lib directory is no more supported by Rails 3. There has been number of if and buts in its support and against but unfortunately it has been removed. While lazy loading was a very good feature where developer need not to keep track of each and every file/folder he needs to manually include.
Fortunately there is a way of enabling autoloading again in Rails 3 . While most of the solution on net only show how to include particular file/folder we can do it for entire lib folder by making following changes in config/application.rb:
#application.rb
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += Dir["#{config.root}/lib/**/"]
0 Comment(s)