Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

require_dependency should require using the normal mechanism if possi…

…ble to avoid double-requires
  • Loading branch information...
commit d599e94e45d5937ca80d9416a571c0e628b95bd3 1 parent 91e4249
@wycats wycats authored
Showing with 15 additions and 7 deletions.
  1. +15 −7 activesupport/lib/active_support/dependencies.rb
View
22 activesupport/lib/active_support/dependencies.rb
@@ -276,14 +276,22 @@ def load?
end
def depend_on(file_name, swallow_load_errors = false, message = "No such file to load -- %s.rb")
- path = search_for_file(file_name)
- require_or_load(path || file_name)
- rescue LoadError => load_error
- unless swallow_load_errors
- if file_name = load_error.message[/ -- (.*?)(\.rb)?$/, 1]
- raise LoadError.new(message % file_name).copy_blame!(load_error)
+ #path = search_for_file(file_name)
+ require_or_load(file_name)
+ rescue LoadError
+ begin
+ if path = search_for_file(file_name)
+ require_or_load(path)
+ else
+ raise
+ end
+ rescue LoadError => load_error
+ unless swallow_load_errors
+ if file_name = load_error.message[/ -- (.*?)(\.rb)?$/, 1]
+ raise LoadError.new(message % file_name).copy_blame!(load_error)
+ end
+ raise
end
- raise
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.