diff options
author | Matt Jones <al2o3cr@gmail.com> | 2008-11-19 12:13:52 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-20 08:52:17 +0100 |
commit | fb1eebac940d0648d1640d20a24f085d901d6f30 (patch) | |
tree | 8fed772adbb64a519993d333236ba52b325f9385 /activesupport/lib | |
parent | 9ad165cb9d4ca5df9b5ba6f01752727427fed949 (diff) | |
download | rails-fb1eebac940d0648d1640d20a24f085d901d6f30.tar.gz rails-fb1eebac940d0648d1640d20a24f085d901d6f30.tar.bz2 rails-fb1eebac940d0648d1640d20a24f085d901d6f30.zip |
alternative resolution to vendor load problem
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 67620e1789..293450c180 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -313,8 +313,13 @@ module ActiveSupport #:nodoc: nesting = expanded_path[(expanded_root.size)..-1] nesting = nesting[1..-1] if nesting && nesting[0] == ?/ next if nesting.blank? - - [ nesting.camelize ] + nesting_camel = nesting.camelize + begin + qualified_const_defined?(nesting_camel) + rescue NameError + next + end + [ nesting_camel ] end.flatten.compact.uniq end @@ -485,28 +490,24 @@ module ActiveSupport #:nodoc: # Build the watch frames. Each frame is a tuple of # [module_name_as_string, constants_defined_elsewhere] watch_frames = descs.collect do |desc| - begin - if desc.is_a? Module - mod_name = desc.name - initial_constants = desc.local_constant_names - elsif desc.is_a?(String) || desc.is_a?(Symbol) - mod_name = desc.to_s - - # Handle the case where the module has yet to be defined. - initial_constants = if qualified_const_defined?(mod_name) - mod_name.constantize.local_constant_names - else - [] - end + if desc.is_a? Module + mod_name = desc.name + initial_constants = desc.local_constant_names + elsif desc.is_a?(String) || desc.is_a?(Symbol) + mod_name = desc.to_s + + # Handle the case where the module has yet to be defined. + initial_constants = if qualified_const_defined?(mod_name) + mod_name.constantize.local_constant_names else - raise Argument, "#{desc.inspect} does not describe a module!" + [] end - [mod_name, initial_constants] - rescue NameError - # mod_name isn't a valid constant name - nil + else + raise Argument, "#{desc.inspect} does not describe a module!" end - end.compact + + [mod_name, initial_constants] + end constant_watch_stack.concat watch_frames |