I have to look for all emails from the User
model that have the substring "cpg". So it would match "cpg@yahoo.com", "cpg3333@yahoo.com", etc
I'm pretty sure how to do case insensitive (using User.where("lower(email)...")
but I don't know how to find a substring.
I'm using Rails 3 + Postgres 9.x
Nothing in Rails to do it, you can just use PostgreSQL's ilike
(case insensitive like function).
Like so: User.where("email ilike '%cpg%'")