title: comparison of Date with nil failed - ruby
body: <p>I am running a code like this:</p>
  
  <pre><code>if valid_from &gt; Date.today
  </code></pre>
  
  <p>and when I run this, I get an error saying</p>
  
  <blockquote>
    <p>comparison of Date with nil failed</p>
  </blockquote>
  
  <p>I assume it is happening because in some cases <code>valid_from</code> is <code>nil</code>. Is there a way to avoid getting this error?</p>