Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…ore places)
  • Loading branch information...
commit 963638aac8f0d66b82e13d6cddf098afb9bc19dc 1 parent fbc40a4
Yehuda Katz wycats authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 activesupport/lib/active_support/dependencies.rb
9 activesupport/lib/active_support/dependencies.rb
View
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.