mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Revert passing arel node with splat binds for where
Passing arel node with splat binds for `where` was introduced at #22877 for uniqueness validator supports prepared statement. But I'd not like to introduce the following usage: ```ruby Foo.where(arel, *binds) ``` I'd like to revert this internal usage.
This commit is contained in:
parent
04d0e3c30b
commit
320996a7e5
2 changed files with 5 additions and 3 deletions
|
@ -22,7 +22,6 @@ module ActiveRecord
|
|||
parts = predicate_builder.build_from_hash(attributes)
|
||||
when Arel::Nodes::Node
|
||||
parts = [opts]
|
||||
binds = other
|
||||
else
|
||||
raise ArgumentError, "Unsupported argument type: #{opts} (#{opts.class})"
|
||||
end
|
||||
|
|
|
@ -76,8 +76,11 @@ module ActiveRecord
|
|||
else
|
||||
klass.connection.case_sensitive_comparison(table, attribute, column, value)
|
||||
end
|
||||
bind = Relation::QueryAttribute.new(attribute_name, value, cast_type)
|
||||
klass.unscoped.where!(comparison, bind)
|
||||
klass.unscoped.tap do |scope|
|
||||
parts = [comparison]
|
||||
binds = [Relation::QueryAttribute.new(attribute_name, value, cast_type)]
|
||||
scope.where_clause += Relation::WhereClause.new(parts, binds)
|
||||
end
|
||||
end
|
||||
|
||||
def scope_relation(record, relation)
|
||||
|
|
Loading…
Reference in a new issue