aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorMehmet Emin INAC <mehmetemininac@gmail.com>2018-01-15 12:03:38 +0100
committerMehmet Emin INAC <mehmetemininac@gmail.com>2018-01-15 16:06:00 +0100
commit899a8014135b1486c693e924fe0e0d6040bf0663 (patch)
treefbb847627b713f25a46abf6f897b27ecea7b54b8 /activerecord/test/cases
parent562dd0494a90d9d47849f052e8913f0050f3e494 (diff)
downloadrails-899a8014135b1486c693e924fe0e0d6040bf0663.tar.gz
rails-899a8014135b1486c693e924fe0e0d6040bf0663.tar.bz2
rails-899a8014135b1486c693e924fe0e0d6040bf0663.zip
Fix relation merger issue with `left_outer_joins`
Diffstat (limited to 'activerecord/test/cases')
-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