Gabriel Sobrinho
2012-Jun-06 17:26 UTC
Default value for case sensitive on uniqueness validator
Hello, The uniqueness validator was always case sensitive but that seems wrong because we want uniqueness validations to be insensitive in most of the time. Do not make more sense be insensitive by default and set sensitive only where it should be? We are migrating a lot of big applications from mysql to postgresql here and we are setting case sensitive to false on **all** uniqueness validations. Note: mysql do not differ case by default, so, it work as insensitive in all situations. Rails will change the major version on 4.0 release and could be a great time to do that if core team agree :) Cheers, Gabriel Sobrinho -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Rodrigo Rosenfeld Rosas
2012-Jun-06 17:40 UTC
Re: Default value for case sensitive on uniqueness validator
Em 06-06-2012 14:26, Gabriel Sobrinho escreveu:> Hello, > > The uniqueness validator was always case sensitive but that seems wrong because we want uniqueness validations to be insensitive in most of the time. > > Do not make more sense be insensitive by default and set sensitive only where it should be? > > > We are migrating a lot of big applications from mysql to postgresql here and we are setting case sensitive to false on **all** uniqueness validations. > > Note: mysql do not differ case by default, so, it work as insensitive in all situations.Yeah that was tricky for me too. I''ve migrated the database of the Grails application I maintain from MySql to PostgreSQL a while ago and as a side effect some users complaint that they were no longer able to login. Then I figured out that the username was case insensitive before as a side effect of using MySql. In my case I changed the application to fetch the user using a case insensitive search (ilike) to keep up with the old behavior. So I guess being case insensitive is good by default specially for user-names so that you would get rid of situations where the user names are different with regards to case sensitive. This is specially true if you intend to migrate from PG to MySql and would have conflicts in the migration path. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.