Skip to content

Commit

Permalink
we already have the module objects, do not constantize
Browse files Browse the repository at this point in the history
I have also chosen a variable name that matches the
parameter in the definition of load_missing_constant.
  • Loading branch information
fxn committed Sep 6, 2012
1 parent 021cb85 commit 2ed325a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions activesupport/lib/active_support/dependencies.rb
Expand Up @@ -169,8 +169,12 @@ def self.exclude_from(base)
end

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)
end

def unloadable(const_desc = self)
Expand Down

0 comments on commit 2ed325a

Please sign in to comment.