diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-05-19 20:00:52 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-19 20:00:52 +0900 |
commit | ea730adb95c8a970924eaf7d492540095518d457 (patch) | |
tree | 662c954df87907035f999b0d11e5417a18653f36 /activerecord/test/cases | |
parent | 339be65d669c83fd4c64541a9e82086dc5e64682 (diff) | |
parent | 7412b7f8a6a2634548671c8ca16941796fac87c4 (diff) | |
download | rails-ea730adb95c8a970924eaf7d492540095518d457.tar.gz rails-ea730adb95c8a970924eaf7d492540095518d457.tar.bz2 rails-ea730adb95c8a970924eaf7d492540095518d457.zip |
Merge pull request #36304 from kamipo/fix_through_association_with_joins
Implicit through table joins should be appeared before user supplied joins
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 8 |
1 files changed, 8 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 0ab99aa6cd..affa024d77 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -58,6 +58,14 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase assert_equal preloaded, Marshal.load(Marshal.dump(preloaded)) end + def test_through_association_with_joins + assert_equal [comments(:eager_other_comment1)], authors(:mary).comments.merge(Post.joins(:comments)) + end + + def test_through_association_with_left_joins + assert_equal [comments(:eager_other_comment1)], authors(:mary).comments.merge(Post.left_joins(:comments)) + end + def test_preload_with_nested_association posts = Post.preload(:author, :author_favorites_with_scope).to_a |