aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-07-26 05:45:30 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-07-26 05:45:30 +0900
commit23b53294cc45bbec696ef026c9728325546e39ec (patch)
tree7ba773f429db167f0b63198d3258f6a118b24898 /activerecord
parenteb080d91ce83bad4d0c20d3f1b68e3daa72b04e5 (diff)
downloadrails-23b53294cc45bbec696ef026c9728325546e39ec.tar.gz
rails-23b53294cc45bbec696ef026c9728325546e39ec.tar.bz2
rails-23b53294cc45bbec696ef026c9728325546e39ec.zip
Building `where_clause` in `UniquenessValidator` is no longer needed
Building `where_clause` manually was introduced at #26073 to include both `comparison` and `binds` in `where_clause`. Since 213796f, `comparison` includes `binds`, so it is enough to use `where` simply.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/validations/uniqueness.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb
index 4f5b157af9..17662592ad 100644
--- a/activerecord/lib/active_record/validations/uniqueness.rb
+++ b/activerecord/lib/active_record/validations/uniqueness.rb
@@ -79,10 +79,7 @@ module ActiveRecord
else
klass.connection.case_sensitive_comparison(table, attribute, column, value)
end
- klass.unscoped.tap do |scope|
- parts = [comparison]
- scope.where_clause += Relation::WhereClause.new(parts)
- end
+ klass.unscoped.where!(comparison)
end
def scope_relation(record, relation)