Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

we already have the module objects, do not constantize

I have also chosen a variable name that matches the
parameter in the definition of load_missing_constant.
  • Loading branch information...
commit 2ed325a3e90fc17c2d52a26bd1799b5f4e4bdf88 1 parent 021cb85
Xavier Noria fxn authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 activesupport/lib/active_support/dependencies.rb
8 activesupport/lib/active_support/dependencies.rb
@@ -169,8 +169,12 @@ def self.exclude_from(base)
def const_missing(const_name)
- namespace = name.presence || "Object"
- Dependencies.load_missing_constant(Inflector.constantize(namespace), const_name)
+ # The interpreter does not pass nesting information, and in the
+ # case of anonymous modules we cannot even make the trade-off of
+ # assuming their name reflects the nesting. Resort to Object as
+ # the only meaningful guess we can make.
+ from_mod = anonymous? ? ::Object : self
+ Dependencies.load_missing_constant(from_mod, const_name)
def unloadable(const_desc = self)
Please sign in to comment.
Something went wrong with that request. Please try again.