diff options
author | Xavier Noria <fxn@hashref.com> | 2012-09-06 14:00:45 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2012-09-06 14:11:04 +0200 |
commit | 2ed325a3e90fc17c2d52a26bd1799b5f4e4bdf88 (patch) | |
tree | e31d85c4078e88d499b728a3ca4ce4236af0442b /activesupport | |
parent | 021cb85b95e46f825876ddb28b7d31338cc9288c (diff) | |
download | rails-2ed325a3e90fc17c2d52a26bd1799b5f4e4bdf88.tar.gz rails-2ed325a3e90fc17c2d52a26bd1799b5f4e4bdf88.tar.bz2 rails-2ed325a3e90fc17c2d52a26bd1799b5f4e4bdf88.zip |
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.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index ad34567fb6..48be96f176 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -169,8 +169,12 @@ module ActiveSupport #:nodoc: 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) |