1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use the correct method for eager loading autoloads

This commit is contained in:
Carl Lerche 2009-12-29 19:04:14 -08:00
parent 153ce2f328
commit e5c88434db
2 changed files with 17 additions and 1 deletions

View file

@ -143,7 +143,7 @@ module Rails
# Used by Passenger to ensure everything's loaded before forking and
# to avoid autoload race conditions in JRuby.
initializer :preload_frameworks do
ActiveSupport::Autoload.eager_load! if config.preload_frameworks
ActiveSupport::Autoload.eager_autoload! if config.preload_frameworks
end
initializer :initialize_cache do

View file

@ -83,5 +83,21 @@ module ApplicationTests
require "#{app_path}/config/application"
end
end
test "Frameworks are not preloaded by default" do
require "#{app_path}/config/environment"
assert ActionController.autoload?(:RecordIdentifier)
end
test "frameworks are preloaded with config.preload_frameworks is set" do
add_to_config <<-RUBY
config.preload_frameworks = true
RUBY
require "#{app_path}/config/environment"
assert !ActionController.autoload?(:RecordIdentifier)
end
end
end