case insensitive finders

It would be useful for issues such as Defect #2473: Login and mail should not be case sensitive - Redmine (Login and mail should not be case sensitive) to support case insensitive finds via the dynamic finders. This is particularly a problem for postgresql users which is case sensitive by default.

Currently people seem to be applying various workarounds (e.g. change from issue above or http://devblog.aoteastudios.com/2009/12/add-case-insensitive-finders-by.html) to deal with this.

I'm not sure whether this is best done as an option to the finder or otherwise. Does anyone have any thoughts on the matter or pointers on implementation?

Thanks Tristan

where(“LOWER(email) = ?”, email) isn’t good enough?

No.

It's a particular problem when using the dynamic "find_or_create_by_email(value)" and the ilk.

The dynamic finders are just syntactic sugar for doing equality based queries. If your database's collation isn't case-insensitive and you want to do case-insensitive queries you'll have to use where as ryan suggested.

Expanding the functionality to support this isn't warranted, just define a scope or use where.