Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

alternative resolution to vendor load problem

  • Loading branch information...
commit 24ead54f2b0f8a2a73bd554f552f2c3a52828525 1 parent 085ebf0
@dhh dhh authored
Showing with 22 additions and 25 deletions.
  1. +22 −25 activesupport/lib/active_support/dependencies.rb
View
47 activesupport/lib/active_support/dependencies.rb
@@ -313,12 +313,13 @@ def loadable_constants_for_path(path, bases = load_paths)
nesting = expanded_path[(expanded_root.size)..-1]
nesting = nesting[1..-1] if nesting && nesting[0] == ?/
next if nesting.blank?
-
- [
- nesting.camelize,
- # Special case: application.rb might define ApplicationControlller.
- ('ApplicationController' if nesting == 'application')
- ]
+ nesting_camel = nesting.camelize
+ begin
+ qualified_const_defined?(nesting_camel)
+ rescue NameError
+ next
+ end
+ [ nesting_camel ]
end.flatten.compact.uniq
end
@@ -489,28 +490,24 @@ def new_constants_in(*descs)
# 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
Please sign in to comment.
Something went wrong with that request. Please try again.