File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
activerecord/test/cases/relation Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -397,15 +397,16 @@ class MergingDifferentRelationsTest < ActiveRecord::TestCase
397
397
test "merging relation with common table expression" do
398
398
posts_with_tags = Post . with ( posts_with_tags : Post . where ( "tags_count > 0" ) ) . from ( "posts_with_tags AS posts" )
399
399
posts_with_comments = Post . where ( "legacy_comments_count > 0" )
400
- relation = posts_with_comments . merge ( posts_with_tags )
400
+ relation = posts_with_comments . merge ( posts_with_tags ) . order ( "posts.id" )
401
401
402
402
assert_equal [ 1 , 2 , 7 ] , relation . pluck ( :id )
403
403
end
404
404
405
405
test "merging multiple relations with common table expression" do
406
406
posts_with_tags = Post . with ( posts_with_tags : Post . where ( "tags_count > 0" ) )
407
407
posts_with_comments = Post . with ( posts_with_comments : Post . where ( "legacy_comments_count > 0" ) )
408
- relation = posts_with_comments . merge ( posts_with_tags ) . joins ( "JOIN posts_with_tags pwt ON pwt.id = posts.id JOIN posts_with_comments pwc ON pwc.id = posts.id" )
408
+ relation = posts_with_comments . merge ( posts_with_tags )
409
+ . joins ( "JOIN posts_with_tags pwt ON pwt.id = posts.id JOIN posts_with_comments pwc ON pwc.id = posts.id" ) . order ( "posts.id" )
409
410
410
411
assert_equal [ 1 , 2 , 7 ] , relation . pluck ( :id )
411
412
end
You can’t perform that action at this time.
0 commit comments