title: Validates numericality only if presence (if user fill it), doesn't work
body: <p>I follow some tips to validates the numericality of a field only if presence, with:</p>
  
  <pre><code>validates_numericality_of :year, only_integer: true, allow_nil: true
  </code></pre>
  
  <p>or</p>
  
  <pre><code>validates_numericality_of :year, only_integer: true, allow_blank: true
  </code></pre>
  
  <p>But I can create it with a year like <code>'asdfasdf'</code> and rails stores a blank year.</p>
  
  <p>What can be wrong?</p>