Rails 3 and Autoloading modules from lib folder

Rails 3 now forces you to explicitly require the files and does not autoload them for you, though the autoload still works for plugins.

The Reference

In order to auto load your lib files you would need to add this bit to your application.rb file

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s