postgresql - How do I make a query search in rails case insensitive? -


i have search method in user.rb model

def self.search(query)     where("description ?", "%#{query}%") end 

but search case sensitive. want make case insensitive. how do that? i'm hoping it's quick fix.

thanks

because using postgresql:

def self.search(query)   where("description ilike ?", "%#{query}%") end 

just use ilike instead of like. like/ilike documentation

if want use =, both sides either upper or lower


Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -