postgresql - Rails case sensitive applications with Postgres -
i'm running new rails app on postgresql , not understand why on earth made postgreql case sensitive , didn't make option turn off.
i mean, really, if registeres "sam" on site, won't able log in "sam", there can 2 different accounts "sam" , "sam". disaster, taking consideration fact all other major databases case insensitive.
now instead of looking user like
user.find_by_name(params[:name])
i'll have this
user.all(:conditions=>["name ilike ?", params[:name]]).first
i can't believe there's no way avoid in rails because destroys 1 of main principles of framework: database independence.
is there better way implement case insensitive username/e-mail schema?
i suppose have 2 db columns, if preserving case important you:
- one login name, convert lower case when user signs up, , use login user, after converting name login form lower case
- one display name, what's displayed username , user gave @ signup
Comments
Post a Comment