diff options
-rw-r--r-- | activesupport/lib/dependencies.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/activesupport/lib/dependencies.rb b/activesupport/lib/dependencies.rb index a6d53f1e2f..7ddc6c318e 100644 --- a/activesupport/lib/dependencies.rb +++ b/activesupport/lib/dependencies.rb @@ -10,10 +10,14 @@ module Dependencies mattr_accessor :mechanism def depend_on(file_name, swallow_load_errors = false) - begin - loaded << require_or_load(file_name) if !loaded.include?(file_name) - rescue LoadError - raise unless swallow_load_errors + if !loaded.include?(file_name) + loaded << file_name + + begin + require_or_load(file_name) + rescue LoadError + raise unless swallow_load_errors + end end end @@ -38,7 +42,6 @@ module Dependencies private def require_or_load(file_name) mechanism == :load ? silence_warnings { load("#{file_name}.rb") } : require(file_name) - return file_name end end @@ -62,4 +65,4 @@ class Object end end end -end +end
\ No newline at end of file |