aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_go_eager_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-07-09 17:14:14 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-07-09 17:14:14 +0000
commit14762fd229dfdde98bef224f198ff1ade7336b5b (patch)
tree2b54f8deff3ffcf002fb88152a45c2122c300cdf /activerecord/test/associations_go_eager_test.rb
parent1d7aa9fe813afb1979dfefd0871d84eb60d92d39 (diff)
downloadrails-14762fd229dfdde98bef224f198ff1ade7336b5b.tar.gz
rails-14762fd229dfdde98bef224f198ff1ade7336b5b.tar.bz2
rails-14762fd229dfdde98bef224f198ff1ade7336b5b.zip
better error message for missing associations #1631 [courtenay]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1787 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_go_eager_test.rb')
-rw-r--r--activerecord/test/associations_go_eager_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/associations_go_eager_test.rb b/activerecord/test/associations_go_eager_test.rb
index 29a0e8a443..110fb8e4ae 100644
--- a/activerecord/test/associations_go_eager_test.rb
+++ b/activerecord/test/associations_go_eager_test.rb
@@ -92,5 +92,17 @@ class EagerAssociationTest < Test::Unit::TestCase
:conditions => ["companies.name = ?", "37signals"])
assert_not_nil companies(:first_firm, :reload).account
end
+
+ def test_eager_with_invalid_association_reference
+ assert_raises(NoMethodError, "Association was not found; perhaps you misspelled it? You specified :include=>:monkeys") {
+ post = Post.find(6, :include=>[ :monkeys ])
+ }
+ assert_raises(NoMethodError, "Association was not found; perhaps you misspelled it? You specified :include=>:monkeys, :elephants") {
+ post = Post.find(6, :include=>[ :monkeys, :elephants ])
+ }
+ end
+
end
+
+