Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Rails 3.0.3 - validates_uniqueness_of case_sensitive fails on UTF8 fields #1014
Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6691
Sorry if this has been fixed in a later release, or is an issue in MySQL, but I'm experiencing an issue with validates_uniqueness_of in my app. Specifically, when I try to violate the rule the validation does not return an error.
Database is MYSQL 5.0.1 (have tried on later versions as well)
On my User model:
In Rails console I find a user record and set it's login to a login that's in use on another record. Then check user.valid? and it's true when it should be false.
The validator emits the following statement:
This query returns no results.
Adding the :case_sensitive => true option gets things working as the validator is forcing both values to LOWER() and not using the BINARY qualifier.
Again, sorry if this is something wrong with MySQL (as in the product of how I have the database set up) and thanks for reading this and supporting Rails.