I a boolean "guessed" on my model "perks" and I am trying to get all customers that have perks where guessed is true.
My first guess was this:
@customer = Customer.includes(:perks).where('perks.guessed = true')
But that gives me an SQL-exception: "no such column: true"
A bit of googling gave me this thread: Rails - how to search based on a boolean field? (MySQL error)
So I tried:
@customer = Customer.includes(:perks).where('perks.guessed = 1')
No luck...
Also tried:
@customer = Customer.includes(:perks).where('perks.guessed LIKE, ?', 'true')
@customer = Customer.includes(:perks).where('perks.guessed = t')
What is the correct way to query for the value of a boolean with a where-statement in activerecord?
I'm using SQLite on dev and Postgres on production btw.