If a file is in the load path, require it without its full path (in more places)

This commit is contained in:
wycats
2010-08-04 03:21:37 -07:00
parent 8bf79739b4
commit 991cd59a22

View File

@@ -388,8 +388,13 @@ module ActiveSupport #:nodoc:
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)