I am launching a new Rails application in Postgresql and I don’t understand why on Earth they made the Postgreql case sensitive and didn’t even make a way to disable it.
I mean, really, if someone logs in as “Sam” on my site, they cannot log in as “sam,” but there can be two different accounts, “Sam” and “Sam”. This is a disaster, especially taking into account the fact that all other main databases are case insensitive.
Now instead of searching for a user like
User.find_by_name(params[:name])
I need to do this
User.all(:conditions=>["name ILIKE ?", params[:name]]).first
I cannot believe that this cannot be avoided in Rails, because it destroys one of the basic principles of the structure: database independence.
Is there a better way to implement a case-insensitive username / email?
source
share