diff options
author | Matt Jones <al2o3cr@gmail.com> | 2008-11-17 14:03:46 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-18 14:32:46 +0100 |
commit | 45ba4ec626b79dda8534f13b3eb01524e0734781 (patch) | |
tree | 84bccc98fa97cb7bfb5244bbd1c0890315b99d32 /activesupport/lib/active_support/dependencies.rb | |
parent | 12118963acacc9c869bdd41ef8480a1a4e06d358 (diff) | |
download | rails-45ba4ec626b79dda8534f13b3eb01524e0734781.tar.gz rails-45ba4ec626b79dda8534f13b3eb01524e0734781.tar.bz2 rails-45ba4ec626b79dda8534f13b3eb01524e0734781.zip |
add vendor/ back to load paths; catch errors in constant loading
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activesupport/lib/active_support/dependencies.rb')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 5dbe466b7b..67620e1789 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -485,24 +485,28 @@ 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| - 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 + 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 else - [] + raise Argument, "#{desc.inspect} does not describe a module!" end - else - raise Argument, "#{desc.inspect} does not describe a module!" + [mod_name, initial_constants] + rescue NameError + # mod_name isn't a valid constant name + nil end - - [mod_name, initial_constants] - end + end.compact constant_watch_stack.concat watch_frames |