rails/rails — pull request #13465 by shugo (2013-12-24 05:58:07+00:00)
Title: validates_uniqueness_of should honor the collation

Currently, if the case_sensitive option of `validates_uniqueness_of` is omitted, `true` is used by default.
However, the default collation of MySQL for `rake db:create:all` in Rails is `utf8_unicode_ci`, which means that you need to specify `case_sensitive: false` for each `validates_uniqueness_of`, except when the collation is explicitly set to `*_bin`. Otherwise, a DB-level unique constraint violation may occur even if the AR-level validation succeeded.

In MySQL each column has its own collation, and the preferred case sensitivity can be guessed from the value of the collation. Why not use the guessed value as the default?