|
4 | 4 | require "models/post" |
5 | 5 | require "models/tagging" |
6 | 6 | require "models/tag" |
| 7 | +require "models/rating" |
7 | 8 | require "models/comment" |
8 | 9 | require "models/author" |
9 | 10 | require "models/essay" |
@@ -44,7 +45,7 @@ def test_eager_loading_too_may_ids |
44 | 45 |
|
45 | 46 | class EagerAssociationTest < ActiveRecord::TestCase |
46 | 47 | fixtures :posts, :comments, :authors, :essays, :author_addresses, :categories, :categories_posts, |
47 | | - :companies, :accounts, :tags, :taggings, :people, :readers, :categorizations, |
| 48 | + :companies, :accounts, :tags, :taggings, :ratings, :people, :readers, :categorizations, |
48 | 49 | :owners, :pets, :author_favorites, :jobs, :references, :subscribers, :subscriptions, :books, |
49 | 50 | :developers, :projects, :developers_projects, :members, :memberships, :clubs, :sponsors |
50 | 51 |
|
@@ -89,6 +90,17 @@ def test_loading_conditions_with_or |
89 | 90 | "expected to find only david's posts" |
90 | 91 | end |
91 | 92 |
|
| 93 | + def test_loading_polymorphic_association_with_mixed_table_conditions |
| 94 | + rating = Rating.first |
| 95 | + assert_equal [taggings(:normal_comment_rating)], rating.taggings_without_tag |
| 96 | + |
| 97 | + rating = Rating.preload(:taggings_without_tag).first |
| 98 | + assert_equal [taggings(:normal_comment_rating)], rating.taggings_without_tag |
| 99 | + |
| 100 | + rating = Rating.eager_load(:taggings_without_tag).first |
| 101 | + assert_equal [taggings(:normal_comment_rating)], rating.taggings_without_tag |
| 102 | + end |
| 103 | + |
92 | 104 | def test_loading_with_scope_including_joins |
93 | 105 | member = Member.first |
94 | 106 | assert_equal members(:groucho), member |
|
0 commit comments