aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_join_model_test.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-03-19 00:53:24 +0000
committerRick Olson <technoweenie@gmail.com>2006-03-19 00:53:24 +0000
commit57af961a80ee01d1876dfc50d93544906a995617 (patch)
tree571058edf37e0903d5bf72bea16925d36a486eda /activerecord/test/associations_join_model_test.rb
parent49efa02b9e8d868b2d28a3db76269d8b8fcde0a6 (diff)
downloadrails-57af961a80ee01d1876dfc50d93544906a995617.tar.gz
rails-57af961a80ee01d1876dfc50d93544906a995617.tar.bz2
rails-57af961a80ee01d1876dfc50d93544906a995617.zip
Raise error when trying to select many polymorphic objects with has_many :through or :include (closes #4226) [josh@hasmanythrough.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3961 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_join_model_test.rb')
-rw-r--r--activerecord/test/associations_join_model_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/test/associations_join_model_test.rb b/activerecord/test/associations_join_model_test.rb
index 9477e69e55..f53a7669f4 100644
--- a/activerecord/test/associations_join_model_test.rb
+++ b/activerecord/test/associations_join_model_test.rb
@@ -213,7 +213,7 @@ class AssociationsJoinModelTest < Test::Unit::TestCase
end
def test_unavailable_through_reflection
- assert_raises (ActiveRecord::ActiveRecordError) { authors(:david).nothings }
+ assert_raises (ActiveRecord::HasManyThroughAssociationNotFoundError) { authors(:david).nothings }
end
def test_has_many_through_join_model_with_conditions
@@ -221,6 +221,15 @@ class AssociationsJoinModelTest < Test::Unit::TestCase
assert_equal [], posts(:welcome).invalid_tags
end
+ def test_has_many_polymorphic
+ assert_raises ActiveRecord::HasManyThroughAssociationPolymorphicError do
+ assert_equal [posts(:welcome), posts(:thinking)], tags(:general).taggables
+ end
+ assert_raises ActiveRecord::EagerLoadPolymorphicError do
+ assert_equal [posts(:welcome), posts(:thinking)], tags(:general).taggings.find(:all, :include => :taggable)
+ end
+ end
+
private
# create dynamic Post models to allow different dependency options
def find_post_with_dependency(post_id, association, association_name, dependency)