diff options
author | wycats <wycats@gmail.com> | 2010-08-04 03:21:37 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-08-04 03:25:57 -0700 |
commit | 991cd59a225b90ab1ba31867810b8fc0942713eb (patch) | |
tree | 371d1e034ef26bf0800e142e874227e572f5b437 /activesupport | |
parent | 8bf79739b4219eb1d6464e6eb4853e92e81d7621 (diff) | |
download | rails-991cd59a225b90ab1ba31867810b8fc0942713eb.tar.gz rails-991cd59a225b90ab1ba31867810b8fc0942713eb.tar.bz2 rails-991cd59a225b90ab1ba31867810b8fc0942713eb.zip |
If a file is in the load path, require it without its full path (in more places)
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 1b93eac7ee..198c124292 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -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) |