Rails 4.x how to query boolean value with activerecord?
问题 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