views:

57

answers:

2

Rails has a feature where models, controllers, views, libraries, etc. are automatically loaded when they are needed. This is especially helpful in development mode, where they get automatically reloaded as well.

How do I tell Rails to perform automatic loading somewhere it doesn't expect to load files? Say, I create a folder app/addons or something, and I want it to load classes there in the same way models are loaded. So if I had app/addons/foo.rb, I want to be able to call the class Foo.

A: 

In your config/environment.rb add the following line to the Rails::Initializer.run block:

config.load_paths += %W( #{RAILS_ROOT/app/addons} )

Jason Noble
Did this work for you?
Jason Noble
A: 

In your environment.rb should be line like this :

config.load_paths += %W( #{RAILS_ROOT}/lib/ #{RAILS_ROOT}/app/addons/ )

Just add some another path you need.

retro