title: Rails 3: How do I validate to allow blanks ("") but not nil (NULL in database)
body: <p>In an ActiveRecord (or ActiveModel) I would like the following spec to pass</p>
  
  <pre><code>it { should allow_value("").for(:my_string) }
  it { should_not allow_value(nil).for(:my_string) }
  </code></pre>
  
  <p>I have tried</p>
  
  <pre><code>validates :my_string, {
    :length =&gt; { :in =&gt; 0..255 },
    :presence =&gt; true,
    :allow_blank =&gt; true,
    :allow_nil =&gt; false,
  }
  </code></pre>
  
  <p>and also</p>
  
  <pre><code>validates :my_string, {
    :length =&gt; { :in =&gt; 0..255 },
    :allow_blank =&gt; true,
    :allow_nil =&gt; false,
  }
  </code></pre>
  
  <p>But either it allows both "" and nil or none of them.</p>