Answer the question
In order to leave comments, you need to log in
How to do case insensitive searches in Rails?
I use the following construction where('lower(name) LIKE ?', "%#{name}.downcase)%"), but for some reason downcase doesn't work and gives out the string I entered
Answer the question
In order to leave comments, you need to log in
Horrible.
1. See the resulting query (interpolation does not work).
2. Use ILIKE instead of manually doing everything.
3. What is the base?
downcase does not work with Cyrillic, you can do this:str.mb_chars.downcase
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question