Best way to load module/class from lib folder in Rails 3?

autoload, class, module, ruby-on-rails, ruby-on-rails-3

Solution

As of Rails 2.3.9, there is a setting in `config/application.rb` in which you can specify directories that contain files you want autoloaded.

From application.rb:

# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)

Problem

Since the latest Rails 3 release is not auto-loading modules and classes from lib anymore, what would be the best way to load them? From github: ``` A few changes were done in this commit: Do not autoload code in *lib* for applications (now you need to explicitly require them). This makes an application behave closer to an engine (code in lib is still autoloaded for plugins); ```

Original source

Related problems