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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -