module ActiveSupport::Dependencies

def search_for_file(path_suffix)

Search for a file in autoload_paths matching the provided suffix.
def search_for_file(path_suffix)
  path_suffix = path_suffix.sub(/(\.rb)?$/, ".rb")
  autoload_paths.each do |root|
    path = File.join(root, path_suffix)
    return path if File.file? path
  end
  nil # Gee, I sure wish we had first_match ;-)
end