diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2016-04-18 17:34:40 -0700 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2016-04-18 17:53:22 -0700 |
commit | f2f2d64429c674a9134bfd011995c30c6cc34dab (patch) | |
tree | d18cd5fa8e14f1b9cf278fdee0b0e262bb6a949f /activerecord/lib/active_record | |
parent | 446190fbd2e1878fa321579f9114496ed8ce44e8 (diff) | |
parent | 811a4fa8eb6ceea841e61e8ac05747ffb69595ae (diff) | |
download | rails-f2f2d64429c674a9134bfd011995c30c6cc34dab.tar.gz rails-f2f2d64429c674a9134bfd011995c30c6cc34dab.tar.bz2 rails-f2f2d64429c674a9134bfd011995c30c6cc34dab.zip |
Merge pull request #23523 from kamipo/avoid_truncation_in_uniqueness_validation
Avoid a string value truncation in uniqueness validation
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/validations/uniqueness.rb | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index 4a80cda0b8..1f59276137 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -67,9 +67,6 @@ module ActiveRecord cast_type = klass.type_for_attribute(attribute_name) value = cast_type.serialize(value) value = klass.connection.type_cast(value) - if value.is_a?(String) && column.limit - value = value.to_s[0, column.limit] - end comparison = if !options[:case_sensitive] && !value.nil? # will use SQL LOWER function before comparison, unless it detects a case insensitive collation |