I used to be able to get files under lib/ loaded automatically,
by referencing the name of the class / module defined in them. This
is no longer true in Rails 3 edge, and I believe it's also not true
in Beta 4.
To reproduce, create a new application, scaffold a blank class
(e.g. rails g scaffold boom), then add the following file:
lib/user_filters.rb
module UserFilters
end
Modify app/controllers/application_controller.rb as
follows:
class ApplicationController < ActionController::Base
protect_from_forgery
include UserFilters
end
Start the server, and go to http://localhost:3000/booms. The
result is a routing error caused by an uninitialized constant
exception.
Started GET "/booms" for 127.0.0.1 at Wed Jun 30 07:12:56 -0400 2010
ActionController::RoutingError (uninitialized constant ApplicationController::UserFilters):
app/controllers/application_controller.rb:3
app/controllers/booms_controller.rb:1
The code will work if I add a require to
app/controllers/application_controller.rb:
require 'user_filters'
If this is an intended change, it would be nice to have it
documented in the release notes. Is there some other convention to
follow to get the autoloading behavior?
Thank you.