I need to create a case-insensitive index on a column in rails. I did this via SQL:
execute( \"CREATE UNIQUE INDEX index_users_on_lower_email_index O
I would simplify this...
In your model:
before_validation :downcase_email def downcase_email self.email = email.downcase end
That way, the index is database agnostic, and your emails are all lowercase in the database.