In the current version of Rails (3.2.8), this has been changed in the application.rb file.
The code is currently commented out as:
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
Will need to update the autoload_paths value. Attempting to modify the the former load_paths variable causes this error.
/configuration.rb:85:in `method_missing': undefined method `load_paths' for #<Rails::Application::Configuration:0xac670b4> (NoMethodError)
for an example, for each path to add to autoload_paths config, add a line similar to the following:
config.autoload_paths += %W(#{config.root}/app/validators)
config.autoload_paths
accepts an array of paths from which Rails will autoload constants. Default is all directories under app
.
http://guides.rubyonrails.org/configuring.html
From commentor (hakunin) below:
If the directory is under app/
, you don't need to add it anywhere, it should just work by default (definitely in 3.2.12). Rails has eager_load_paths
that acts as autoload_paths
in development, and eager load in production. All app/*
directories are automatically added there.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…