From a8bf12979e5fa15282b39c8cfa315e663f613539 Mon Sep 17 00:00:00 2001 From: Andrew White <andyw@pixeltrix.co.uk> Date: Tue, 19 Feb 2013 07:28:11 +0000 Subject: Don't unhook autoloading in production Whilst autoloading is known to be not threadsafe, leaving it in place is a softer solution than failing hard when an application is deployed. Many older applications will have paths added to `autoload_paths` and ideally these should be eagerly loaded to be threadsafe. However one of these paths is quite often lib which could lead to unintended consequences due to the 'junk drawer' nature of this directory. Developers should refrain from adding paths to `autoload_paths` or `eager_load_paths` and use custom folders inside app for code that needs to be eagerly loaded and use `require` or `require_dependency` to explicitly load code from other locations. --- railties/lib/rails/application/finisher.rb | 7 ------- 1 file changed, 7 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index 872d78d9a4..3ae60312c5 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -89,13 +89,6 @@ module Rails ActionDispatch::Reloader.to_cleanup(&callback) end end - - # Disable dependency loading during request cycle - initializer :disable_dependency_loading do - if config.eager_load && config.cache_classes - ActiveSupport::Dependencies.unhook! - end - end end end end -- cgit v1.2.3