aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2017-07-28 12:42:23 -0400
committerGitHub <noreply@github.com>2017-07-28 12:42:23 -0400
commit904f1a8747958129124d86b44e36c5f0263e0125 (patch)
treef5b2edf3d6ae621c5ed98369d2174e242fce6601
parentc33fb580cd00cea476fe211586ca73787e2f0759 (diff)
parent23b53294cc45bbec696ef026c9728325546e39ec (diff)
downloadrails-904f1a8747958129124d86b44e36c5f0263e0125.tar.gz
rails-904f1a8747958129124d86b44e36c5f0263e0125.tar.bz2
rails-904f1a8747958129124d86b44e36c5f0263e0125.zip
Merge pull request #29946 from kamipo/passing_arel_to_where_is_boundable
Building `where_clause` in `UniquenessValidator` is no longer needed
-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 be704f89b3..2677fade18 100644
--- a/activerecord/lib/active_record/validations/uniqueness.rb
+++ b/activerecord/lib/active_record/validations/uniqueness.rb
@@ -78,10 +78,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)