From 278f0dfeac03e9e9d57eae8f4618ff94d8584abe Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 30 Mar 2019 08:38:41 +0100 Subject: fixes eager loading edge case in :zeitwerk mode --- railties/lib/rails/engine.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 07bd56c978..2b5afd51b8 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -567,12 +567,15 @@ module Rails ActiveSupport::Dependencies.autoload_paths.unshift(*_all_autoload_paths) ActiveSupport::Dependencies.autoload_once_paths.unshift(*_all_autoload_once_paths) - # Freeze so future modifications will fail rather than do nothing mysteriously config.autoload_paths.freeze - config.eager_load_paths.freeze config.autoload_once_paths.freeze end + initializer :set_eager_load_paths, before: :bootstrap_hook do + ActiveSupport::Dependencies._eager_load_paths.merge(config.eager_load_paths) + config.eager_load_paths.freeze + end + initializer :add_routing_paths do |app| routing_paths = paths["config/routes.rb"].existent -- cgit v1.2.3