1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use real_mod_name on check for removed module

Previously this check could break if `name` was overridden on the module
we were checking.
This commit is contained in:
John Hawthorn 2020-09-02 14:05:52 -07:00
parent 9055156668
commit 15874514fa

View file

@ -533,7 +533,8 @@ module ActiveSupport #:nodoc:
# it is not possible to load the constant into from_mod, try its parent # it is not possible to load the constant into from_mod, try its parent
# module using +const_missing+. # module using +const_missing+.
def load_missing_constant(from_mod, const_name) def load_missing_constant(from_mod, const_name)
unless qualified_const_defined?(from_mod.name) && Inflector.constantize(from_mod.name).equal?(from_mod) from_mod_name = real_mod_name(from_mod)
unless qualified_const_defined?(from_mod_name) && Inflector.constantize(from_mod_name).equal?(from_mod)
raise ArgumentError, "A copy of #{from_mod} has been removed from the module tree but is still active!" raise ArgumentError, "A copy of #{from_mod} has been removed from the module tree but is still active!"
end end