title: Validate boolean fields in Rails ActiveRecord
body: <p>I need to validate boolean fields for a Rails ActiveRecord object. I used the common solution to this problem:</p>
  
  <pre><code>validates :boolean_field, :inclusion =&gt; { :in =&gt; [true, false] }
  </code></pre>
  
  <p>But although this solutions solves the problem with validating <code>false</code> values, it still allows to save strings to the <code>boolean_field</code>:</p>
  
  <pre><code>my_object.boolean_field = "string"
  my_object.save # =&gt; true
  my_object.boolean_field # =&gt; false
  </code></pre>
  
  <p>Why does this happen if I specified the inclusion to <code>[true, false]</code>? And more importantly, how do I validate <strong>only</strong> true and false values?</p>
  
  <p>P.S. If it is important to the question, I'm using PostgreSQL.</p>