diff options
author | Xavier Noria <fxn@hashref.com> | 2019-04-11 22:43:45 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2019-04-11 23:10:13 +0200 |
commit | 7b6b10542d5dac2b50f2578143dc5d70120d1146 (patch) | |
tree | 97faab6b3ebdd667a068d8955ecfa8ffa392a589 /activesupport | |
parent | 23392eff9f8065475739e58232a5db97604f8056 (diff) | |
download | rails-7b6b10542d5dac2b50f2578143dc5d70120d1146.tar.gz rails-7b6b10542d5dac2b50f2578143dc5d70120d1146.tar.bz2 rails-7b6b10542d5dac2b50f2578143dc5d70120d1146.zip |
improves the reloading disabled error message
The original message from Zeitwerk is "can't reload, please call
loader.enable_reloading before setup (Zeitwerk::Error)", which is not
very informative for Rails programmers.
Rails should err with a message worded in terms of its interface.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/activesupport.gemspec | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/dependencies/zeitwerk_integration.rb | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec index 546cc1797a..dd2340cdd3 100644 --- a/activesupport/activesupport.gemspec +++ b/activesupport/activesupport.gemspec @@ -34,5 +34,5 @@ Gem::Specification.new do |s| s.add_dependency "tzinfo", "~> 1.1" s.add_dependency "minitest", "~> 5.1" s.add_dependency "concurrent-ruby", "~> 1.0", ">= 1.0.2" - s.add_dependency "zeitwerk", "~> 2.1" + s.add_dependency "zeitwerk", "~> 2.1", ">= 2.1.2" end diff --git a/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb b/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb index b0f7a3f9cc..f16a9f7e57 100644 --- a/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb +++ b/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb @@ -9,7 +9,11 @@ module ActiveSupport module Decorations def clear Dependencies.unload_interlock do - Rails.autoloaders.main.reload + begin + Rails.autoloaders.main.reload + rescue Zeitwerk::ReloadingDisabledError + raise "reloading is disabled because config.cache_classes is true" + end end end |