diff options
author | wycats <wycats@gmail.com> | 2010-07-26 00:59:54 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-07-26 00:59:54 -0700 |
commit | 1b97701e51667e6040b4c576cce9234edef1019e (patch) | |
tree | d3004d11a50d3a011a1b701c4195081aa6e913ad /activesupport/lib/active_support | |
parent | 13df581ec77cc7e5351570c5035a563b946532d5 (diff) | |
download | rails-1b97701e51667e6040b4c576cce9234edef1019e.tar.gz rails-1b97701e51667e6040b4c576cce9234edef1019e.tar.bz2 rails-1b97701e51667e6040b4c576cce9234edef1019e.zip |
Fix a bug where requires inside of autoloads were being added to the autoloaded_constants list, causing mayhem. [#5165 state:resolved]
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 9a6da38b1c..2b80bd214f 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -72,10 +72,6 @@ module ActiveSupport #:nodoc: methods.each { |m| class_eval "def #{m}(*) lock { super } end", __FILE__, __LINE__ } end - def get(key) - (val = assoc(key)) ? val[1] : [] - end - locked :concat, :each, :delete_if, :<< def new_constants_for(frames) @@ -85,7 +81,18 @@ module ActiveSupport #:nodoc: next unless mod.is_a?(Module) new_constants = mod.local_constant_names - prior_constants - get(mod_name).concat(new_constants) + + # If we are checking for constants under, say, :Object, nested under something + # else that is checking for constants also under :Object, make sure the + # parent knows that we have found, and taken care of, the constant. + # + # In particular, this means that since Kernel.require discards the constants + # it finds, parents will be notified that about those constants, and not + # consider them "new". As a result, they will not be added to the + # autoloaded_constants list. + each do |key, value| + value.concat(new_constants) if key == mod_name + end new_constants.each do |suffix| constants << ([mod_name, suffix] - ["Object"]).join("::") |