diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-08-08 22:08:09 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-08-08 22:08:09 +0000 |
commit | 9bd007c7c7270f2816c6cde4a40b138edf82130c (patch) | |
tree | 190d0d86118682148b6ee9451e8c6a7c541bb45f /activesupport/lib/active_support | |
parent | 4635d33996eaa2158e5149871af17a8612949614 (diff) | |
download | rails-9bd007c7c7270f2816c6cde4a40b138edf82130c.tar.gz rails-9bd007c7c7270f2816c6cde4a40b138edf82130c.tar.bz2 rails-9bd007c7c7270f2816c6cde4a40b138edf82130c.zip |
Add forgotten files; Fix double loading errors.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4730 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index f5d047ee07..81f0e6f449 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -51,11 +51,12 @@ module Dependencies #:nodoc: def require_or_load(file_name, const_path = nil) file_name = $1 if file_name =~ /^(.*)\.rb$/ - return if loaded.include?(file_name) + expanded = File.expand_path(file_name) + return if loaded.include?(expanded) # Record that we've seen this file *before* loading it to avoid an # infinite loop with mutual dependencies. - loaded << file_name + loaded << expanded if load? begin @@ -64,13 +65,13 @@ module Dependencies #:nodoc: load_args = ["#{file_name}.rb"] load_args << const_path unless const_path.nil? - if !warnings_on_first_load or history.include?(file_name) + if !warnings_on_first_load or history.include?(expanded) load_file(*load_args) else enable_warnings { load_file(*load_args) } end rescue - loaded.delete file_name + loaded.delete expanded raise end else @@ -78,7 +79,7 @@ module Dependencies #:nodoc: end # Record history *after* loading so first load gets warnings. - history << file_name + history << expanded end # Is the provided constant path defined? @@ -155,7 +156,7 @@ module Dependencies #:nodoc: name_error = NameError.new("uninitialized constant #{qualified_name}") file_path = search_for_autoload_file(path_suffix) - if file_path #&& ! loaded.include?(file_path) # We found a matching file to load + if file_path && ! loaded.include?(File.expand_path(file_path)) # We found a matching file to load require_or_load file_path, qualified_name raise LoadError, "Expected #{file_path} to define #{qualified_name}" unless from_mod.const_defined?(const_name) return from_mod.const_get(const_name) |