aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation/merging_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-01-16 01:39:14 +0900
committerGitHub <noreply@github.com>2018-01-16 01:39:14 +0900
commitd8e7d6b03c50f4f01c333461c46666d8210e2c17 (patch)
treefbb847627b713f25a46abf6f897b27ecea7b54b8 /activerecord/test/cases/relation/merging_test.rb
parent562dd0494a90d9d47849f052e8913f0050f3e494 (diff)
parent899a8014135b1486c693e924fe0e0d6040bf0663 (diff)
downloadrails-d8e7d6b03c50f4f01c333461c46666d8210e2c17.tar.gz
rails-d8e7d6b03c50f4f01c333461c46666d8210e2c17.tar.bz2
rails-d8e7d6b03c50f4f01c333461c46666d8210e2c17.zip
Merge pull request #27860 from meinac/fix_left_joins_behaviour_with_merge
Fix relation merger issue with `left_outer_joins`.
Diffstat (limited to 'activerecord/test/cases/relation/merging_test.rb')
-rw-r--r--activerecord/test/cases/relation/merging_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation/merging_test.rb b/activerecord/test/cases/relation/merging_test.rb
index b68b3723f6..f31df40c91 100644
--- a/activerecord/test/cases/relation/merging_test.rb
+++ b/activerecord/test/cases/relation/merging_test.rb
@@ -72,6 +72,12 @@ class RelationMergingTest < ActiveRecord::TestCase
assert_equal 1, comments.count
end
+ def test_relation_merging_with_left_outer_joins
+ comments = Comment.joins(:post).where(body: "Thank you for the welcome").merge(Post.left_outer_joins(:author).where(body: "Such a lovely day"))
+
+ assert_equal 1, comments.count
+ end
+
def test_relation_merging_with_association
assert_queries(2) do # one for loading post, and another one merged query
post = Post.where(body: "Such a lovely day").first