diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2017-07-28 12:36:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-28 12:36:05 -0400 |
commit | c33fb580cd00cea476fe211586ca73787e2f0759 (patch) | |
tree | 4db5573138b6f95bec45a2403f327c0e03fbf23c /activerecord/lib/active_record/validations | |
parent | a54e13bd2e8fb4d6aa0aebe59271699a2d62567b (diff) | |
parent | d148c32983bbf1a2b60deed25e3b4eb4fb28d084 (diff) | |
download | rails-c33fb580cd00cea476fe211586ca73787e2f0759.tar.gz rails-c33fb580cd00cea476fe211586ca73787e2f0759.tar.bz2 rails-c33fb580cd00cea476fe211586ca73787e2f0759.zip |
Merge pull request #29979 from kamipo/use_build_bind_attribute
Use `predicate_builder.build_bind_attribute` wherever possible
Diffstat (limited to 'activerecord/lib/active_record/validations')
-rw-r--r-- | activerecord/lib/active_record/validations/uniqueness.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index 4f5b157af9..be704f89b3 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -67,12 +67,11 @@ module ActiveRecord end attribute_name = attribute.to_s + value = klass.predicate_builder.build_bind_attribute(attribute_name, value) table = klass.arel_table column = klass.columns_hash[attribute_name] - cast_type = klass.type_for_attribute(attribute_name) - value = Relation::QueryAttribute.new(attribute_name, value, cast_type) comparison = if !options[:case_sensitive] # will use SQL LOWER function before comparison, unless it detects a case insensitive collation klass.connection.case_insensitive_comparison(table, attribute, column, value) |