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

java - BeanIO write annotated class to fixedlength -

Using Java 8 lambdas/transformations to combine and flatten two Maps -

How to connect android app to App engine -