提交 7abde136 编写于 作者: R Rafael Mendonça França

Merge pull request #15285 from sergey-alekseev/remove-active-record-where-duplicated-condition

Remove duplicated parameter check on #where!
......@@ -573,15 +573,11 @@ def where(opts = :chain, *rest)
end
end
def where!(opts = :chain, *rest) # :nodoc:
if opts == :chain
WhereChain.new(self)
else
references!(PredicateBuilder.references(opts)) if Hash === opts
def where!(opts, *rest) # :nodoc:
references!(PredicateBuilder.references(opts)) if Hash === opts
self.where_values += build_where(opts, rest)
self
end
self.where_values += build_where(opts, rest)
self
end
# Allows you to change a previously set where condition for a given attribute, instead of appending to that condition.
......
......@@ -99,7 +99,7 @@ def test_chaining_multiple
assert_bound_ast value, Post.arel_table[@name], Arel::Nodes::NotEqual
assert_equal 'ruby on rails', bind.last
end
def test_rewhere_with_one_condition
relation = Post.where(title: 'hello').where(title: 'world').rewhere(title: 'alone')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册