DEV: Use internal __autoloads for zeitwork reload check (#20260)

Since ad6c028484
in the zeitwork repo which was introduced to discourse/discourse in PR #20253,
the `autoloads` attribute on the loader has been marked `internal`, which means
that it errors if we try to access it directly.

Instead we should access it via the "mangled" version so it is clear
we're accessing an internal property, which is `__autoloads`.

Without this, any time a ruby file is saved the
000-development_reload_warnings.rb initializer will error.
This commit is contained in:
Martin Brennan 2023-02-13 16:26:40 +10:00 committed by GitHub
parent 25a226279a
commit 7a593e2fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ if Rails.env.development? && !Rails.configuration.cache_classes && Discourse.run
not_autoloaded =
files.filter_map do |file|
autoloaded = Rails.autoloaders.main.autoloads.key? file
autoloaded = Rails.autoloaders.main.__autoloads.key? file
Pathname.new(file).relative_path_from(Rails.root) if !autoloaded
end