This project is archived and is in readonly mode.

#932 ✓resolved
Eugene Pimenov

validates_uniqueness_of is unicode unaware

Reported by Eugene Pimenov | August 29th, 2008 @ 11:50 AM | in 2.x

Validate_uniqueness in case insensitive mode use downcase which is unicode-unaware. With an unicode aware database, lower(field) != downcased value so it fails to validate anything.

The patch is a simple one-liner.

In the test “Topic.find(t_utf8, :select => 'LOWER(title) AS title').title == "я тоже уникальный!"” checks unicode awareness of database. For example, In MySQL “alter database activerecord_unittest charset=utf8” make this condition true, and “alter database activerecord_unittest charset=latin1” make it false.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages