I am using Ruby on Rails. I want to store usernames into a database and when I extract them I want them to have the same capitalisation as it had when entered, but I want to add some validation that is not case sensitive to ensure the same username cannot be taken, no matter the capitalisation.
I say this because not all database adapters use case-sensitive indices so I would need to down-case the username before it was saved into the database.
So the validation in the model would be this:
uniqueness: { case_sensitive: false }
How would I go about doing this?