PG::Error: ERROR: operator does not exist: integer ~~ unknown
Posted
by
rsvmrk
on Stack Overflow
See other posts from Stack Overflow
or by rsvmrk
Published on 2013-07-01T09:56:08Z
Indexed on
2013/07/01
10:21 UTC
Read the original article
Hit count: 240
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?
© Stack Overflow or respective owner