diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 336bff9534..d882a6714a 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -148,15 +148,6 @@ module Rails $LOAD_PATH.uniq! end - Initializer.default.add :add_gem_load_paths do - require 'rails/gem_dependency' - Rails::GemDependency.add_frozen_gem_path - unless config.gems.empty? - require "rubygems" - config.gems.each { |gem| gem.add_load_paths } - end - end - # Requires all frameworks specified by the Configuration#frameworks # list. By default, all frameworks (Active Record, Active Support, # Action Pack, Action Mailer, and Active Resource) are loaded. @@ -221,6 +212,15 @@ module Rails end end + Initializer.default.add :add_gem_load_paths do + require 'rails/gem_dependency' + Rails::GemDependency.add_frozen_gem_path + unless config.gems.empty? + require "rubygems" + config.gems.each { |gem| gem.add_load_paths } + end + end + # Preload all frameworks specified by the Configuration#frameworks. # Used by Passenger to ensure everything's loaded before forking and # to avoid autoload race conditions in JRuby.