aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2005-09-12 14:41:51 +0000
committerNicholas Seckar <nseckar@gmail.com>2005-09-12 14:41:51 +0000
commite14acca8a83f14d40d29cdd3418d626ca1043c07 (patch)
treee1264b42e35f159831365c1587637211f4cc98c5
parentde4cd789aeaa06514bebc90a6ccf1ea4f879f3c6 (diff)
downloadrails-e14acca8a83f14d40d29cdd3418d626ca1043c07.tar.gz
rails-e14acca8a83f14d40d29cdd3418d626ca1043c07.tar.bz2
rails-e14acca8a83f14d40d29cdd3418d626ca1043c07.zip
Fixed dependencies related infinite recursion bug when a controller file does not contain a controller class. Closes #1760.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2218 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support/dependencies.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index fd937adc5a..cf0cfbc826 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed dependencies related infinite recursion bug when a controller file does not contain a controller class. Closes #1760. [rcolli2@tampabay.rr.com]
+
* Fixed inflections for status, quiz, move #2056 [deirdre@deirdre.net]
* Added Hash#reverse_merge, Hash#reverse_merge!, and Hash#reverse_update to ease the use of default options
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index c37e868b83..78e445afe4 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -93,10 +93,16 @@ module Dependencies #:nodoc:
end
break
when File.file?(fs_path)
- self.root.load_file!(fs_path)
+ loaded_file = self.root.load_file!(fs_path)
# Import the loaded constant from Object provided we are the root node.
self.const_set(name, Object.const_get(name)) if self.root? && Object.const_defined?(name)
+
+ # Throw an error if we load the file but we don't find the Object we expect
+ if loaded_file and not self.const_defined?(name)
+ msg = "Already loaded file '#{fs_path}' but '#{name.to_s}' was not set, perhaps you need to rename '#{fs_path}'?"
+ raise LoadError, msg
+ end
break
end
end