From 2f98032fc92ce16125f8628b4d3c283f10494f4d Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Fri, 19 Feb 2010 10:10:45 -0800 Subject: Fix a problem where nil was appearing in the list --- activesupport/lib/active_support/dependencies.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index da1050298b..a3a7df7464 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -76,17 +76,19 @@ module ActiveSupport #:nodoc: locked :concat, :each, :delete_if, :<< def new_constants_for(frames) - frames.map do |mod_name, prior_constants| + constants = [] + frames.each do |mod_name, prior_constants| mod = Inflector.constantize(mod_name) if Dependencies.qualified_const_defined?(mod_name) next unless mod.is_a?(Module) new_constants = mod.local_constant_names - prior_constants get(mod_name).concat(new_constants) - new_constants.map do |suffix| - ([mod_name, suffix] - ["Object"]).join("::") + new_constants.each do |suffix| + constants << ([mod_name, suffix] - ["Object"]).join("::") end - end.flatten + end + constants end # Add a set of modules to the watch stack, remembering the initial constants -- cgit v1.2.3