This project is archived and is in readonly mode.
validates uniqueness of should take advantage of the database
Reported by Aaron Patterson | March 29th, 2010 @ 06:13 AM
Currently, case-insensitive validations use ruby to lower case a string on one side, and the database to lower case on the other. That results in a question that looks like this:
"SELECT \"topics\".\"id\" FROM \"topics\" WHERE (LOWER(\"topics\".\"title\") = E'я тоже УНИКАЛЬНЫЙ!') LIMIT 1"
This is fine, except that sometimes Ruby does not know how to lower case the same way the database does. In fact, with 1.9.2, the "test_validate_case_insensitive_uniqueness" test fails because ruby 1.9 does not downcase the string the same way ruby 1.8 does.
This patch switches the validation to use LOWER() on both sides of the comparison, and avoid what Ruby thinks.
Comments and changes to this ticket
-
Aaron Patterson March 29th, 2010 @ 06:15 AM
- no changes were found...
-
Repository March 29th, 2010 @ 06:17 AM
- State changed from new to resolved
(from [98d2d8ce2c2f332ee337b9ab2110300e1f2bf1f2]) use the database to lower case strings rather than ruby. [#4293 state:resolved]
Signed-off-by: wycats wycats@gmail.com
http://github.com/rails/rails/commit/98d2d8ce2c2f332ee337b9ab211030...
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>
People watching this ticket
Attachments
Tags
Referenced by
- 4293 validates uniqueness of should take advantage of the database (from [98d2d8ce2c2f332ee337b9ab2110300e1f2bf1f2]) use the...