We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1d22ea8 + c210600 commit 32819c5Copy full SHA for 32819c5
activerecord/lib/active_record/relation/merger.rb
@@ -69,6 +69,8 @@ def merge
69
end
70
71
72
+ relation.none! if other.null_relation?
73
+
74
merge_select_values
75
merge_multi_values
76
merge_single_values
activerecord/test/cases/null_relation_test.rb
@@ -59,6 +59,16 @@ def test_null_relation_content_size_methods
59
60
61
62
+ def test_null_relation_used_with_constraints
63
+ post = Post.first
64
+ assert_no_queries do
65
+ scope = post.comments
66
+ none = Post.none
67
+ scope = scope.merge(none)
68
+ assert_equal 0, scope.size
+ end
def test_null_relation_metadata_methods
assert_includes Developer.none.to_sql, " WHERE (1=0)"
assert_equal({}, Developer.none.where_values_hash)
0 commit comments