Permalink
Browse files

If a file is in the load path, require it without its full path (in m…

…ore places)
  • Loading branch information...
1 parent fbc40a4 commit 963638aac8f0d66b82e13d6cddf098afb9bc19dc @wycats wycats committed Aug 4, 2010
Showing with 7 additions and 2 deletions.
  1. +7 −2 activesupport/lib/active_support/dependencies.rb
@@ -388,8 +388,13 @@ def loadable_constants_for_path(path, bases = autoload_paths)
end
# Search for a file in autoload_paths matching the provided suffix.
- def search_for_file(path_suffix)
- path_suffix = path_suffix.sub(/(\.rb)?$/, ".rb")
+ def search_for_file(file)
+ path_suffix = file.sub(/(\.rb)?$/, ".rb")
+
+ $:.each do |root|
+ path = File.join(root, path_suffix)
+ return file if File.file?(path)
+ end
autoload_paths.each do |root|
path = File.join(root, path_suffix)

0 comments on commit 963638a

Please sign in to comment.