diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-05-18 10:42:26 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-07-07 05:03:53 +0900 |
commit | d3303c31c23e7fdbd9e523c628c111ef6bea0e74 (patch) | |
tree | a4c8b7d0184a0ff79915568246c54bf0ae76c08a /activerecord/test/cases | |
parent | c8ce3459648ce0f86646b564ce1c0bb16a4b48eb (diff) | |
download | rails-d3303c31c23e7fdbd9e523c628c111ef6bea0e74.tar.gz rails-d3303c31c23e7fdbd9e523c628c111ef6bea0e74.tar.bz2 rails-d3303c31c23e7fdbd9e523c628c111ef6bea0e74.zip |
Add a test case for overwriting existing condition on associations
Overwriting existing condition on associations has already supported
(23bcc65 for eager loading, 2bfa2c0 for preloading).
Fixes #27724.
Closes #29154.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 1c2138a3d0..a76159fb99 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -946,6 +946,13 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase end end + def test_has_many_through_polymorphic_with_rewhere + post = TaggedPost.create!(title: "Tagged", body: "Post") + tag = post.tags.create!(name: "Tag") + assert_equal [tag], TaggedPost.preload(:tags).last.tags + assert_equal [tag], TaggedPost.eager_load(:tags).last.tags + end + def test_has_many_through_polymorphic_with_primary_key_option assert_equal [categories(:general)], authors(:david).essay_categories |