Answer the question
In order to leave comments, you need to log in
How to make a query case insensitive?
news = News.arel_table
query_string = "%#{params[:text]}%"
@news = News.where(news[:title].matches(query_string))
Answer the question
In order to leave comments, you need to log in
For Postgres, you can do something like this:
query_string = UnicodeUtils.upcase(params[:text], :ru)
@news = News.where('UPPER(news.title) LIKE ?', "%#{query_string}%")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question