aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2019-06-04 10:02:04 -0400
committereileencodes <eileencodes@gmail.com>2019-06-04 10:04:30 -0400
commit61c3ea8c048515fd2f1af30a7763c4aeddf7a5d6 (patch)
tree403d64883b8000deb239d529fe247007535e83c3 /railties
parent0244a10b7f05105bc4e476c2f28e4febb769307c (diff)
downloadrails-61c3ea8c048515fd2f1af30a7763c4aeddf7a5d6.tar.gz
rails-61c3ea8c048515fd2f1af30a7763c4aeddf7a5d6.tar.bz2
rails-61c3ea8c048515fd2f1af30a7763c4aeddf7a5d6.zip
Merge pull request #36395 from cpruitt/6-0-stable
Do not clear deprecated initializer dependencies if using classic autoloader
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/application/finisher.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb
index 109c560c80..9f4009ad20 100644
--- a/railties/lib/rails/application/finisher.rb
+++ b/railties/lib/rails/application/finisher.rb
@@ -39,8 +39,14 @@ module Rails
example = autoloaded.first
example_klass = example.constantize.class
- ActiveSupport::DescendantsTracker.clear
- ActiveSupport::Dependencies.clear
+ if config.autoloader == :zeitwerk
+ ActiveSupport::DescendantsTracker.clear
+ ActiveSupport::Dependencies.clear
+
+ unload_message = "#{these} autoloaded #{constants} #{have} been unloaded."
+ else
+ unload_message = "`config.autoloader` is set to `#{config.autoloader}`. #{these} autoloaded #{constants} would have been unloaded if `config.autoloader` had been set to `:zeitwerk`."
+ end
ActiveSupport::Deprecation.warn(<<~WARNING)
Initialization autoloaded the #{constants} #{enum}.
@@ -52,7 +58,7 @@ module Rails
initialization does not run again. So, if you reload #{example}, for example,
the expected changes won't be reflected in that stale #{example_klass} object.
- #{these} autoloaded #{constants} #{have} been unloaded.
+ #{unload_message}
Please, check the "Autoloading and Reloading Constants" guide for solutions.
WARNING