diff options
author | Elise Huard <git@elisehuard.be> | 2009-08-09 10:24:28 +0200 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-08-09 12:50:04 -0700 |
commit | c5896bfd8432f6b7a1c6cb06486c5c85eafe9450 (patch) | |
tree | 476a0865dd27515f944631266d448400fc30833a /activerecord/lib | |
parent | 87e2c1895f486937cfb5ea2a3a4168b3a57d447b (diff) | |
download | rails-c5896bfd8432f6b7a1c6cb06486c5c85eafe9450.tar.gz rails-c5896bfd8432f6b7a1c6cb06486c5c85eafe9450.tar.bz2 rails-c5896bfd8432f6b7a1c6cb06486c5c85eafe9450.zip |
validate uniqueness with limit in utf8
[#2653 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/validations/uniqueness.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index edec4e9e43..711086dc2c 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -119,7 +119,7 @@ module ActiveRecord comparison_operator = "IS ?" elsif column.text? comparison_operator = "#{connection.case_sensitive_equality_operator} ?" - value = column.limit ? value.to_s[0, column.limit] : value.to_s + value = column.limit ? value.to_s.mb_chars[0, column.limit] : value.to_s else comparison_operator = "= ?" end |