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