PG::Error: ERROR: operator does not exist: integer ~~ unknown
- by rsvmrk
I'm making a search-function in a Rails project with Postgres as db.
Here's my code
def self.search(search)
if search
find(:all, :conditions => ["LOWER(name) LIKE LOWER(?) OR LOWER(city) LIKE LOWER(?) OR LOWER(address) LIKE LOWER(?) OR (venue_type) LIKE (?)", "%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%"])
else
find(:all)
end
end
But my problem is that "venue_type" is an integer. I've made a case switch for venue_type
def venue_type_check
case self.venue_type
when 1
"Pub"
when 2
"Nattklubb"
end
end
Now to my question: How can I find something in my query when venue_type is an int?