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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -