提交 e8cdb3d5 编写于 作者: J Jon Leighton

allow merging a single where value

上级 f3fce59d
......@@ -85,7 +85,7 @@ def merged_binds
def merged_wheres
if values[:where]
merged_wheres = relation.where_values + values[:where]
merged_wheres = relation.where_values + Array(values[:where])
unless relation.where_values.empty?
# Remove duplicates, last one wins.
......
......@@ -156,6 +156,12 @@ def test_references_values_dont_duplicate
relation = Relation.new(:a, :b, where: [:foo])
assert_equal [:foo], relation.where_values
end
test 'merging a single where value' do
relation = Relation.new(:a, :b)
relation.merge!(where: :foo)
assert_equal [:foo], relation.where_values
end
end
class RelationMutationTest < ActiveSupport::TestCase
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册