From 23b53294cc45bbec696ef026c9728325546e39ec Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 26 Jul 2017 05:45:30 +0900 Subject: 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. --- activerecord/lib/active_record/validations/uniqueness.rb | 5 +---- 1 file changed, 1 insertion(+), 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) -- cgit v1.2.3