case sensitive find_by

Hi all, Do any one knows how to make find_by method case sensitive?

Thanks in advance, Mostafa Badawi

Hi

Do any one knows how to make /find_by/ method case sensitive?

Case sensitivity doesn't depend on rails, but on your DBMS settings.

Assuming you are using mysql, the default encoding/collation are latin1 and latin1_swedish_ci where "_ci" stands for "case insensitive".

If you want to run all your queries in a case sensitive way, you can just change the encoding of your database or of that particular table or column.

If you want to use it in a single query, you can use the COLLATE operator as a part of your condition and specify a case sensitive collation.

If you are not using MySQL, still the theory is the same, but the details will change :wink:

good luck,