title: Ruby sort by (integer) "comparison of NilClass with 3200 failed"
body: <p>I want to sort my records in an rails application:</p>
  
  <pre><code>@ebms = Ebm.all
  @ebms.sort_by! {|u| u.number}
  </code></pre>
  
  <p>The <code>u.number</code> is defined as integer!
  The problem is that Rails cannot compare it with <code>nil</code>:</p>
  
  <pre><code>comparison of NilClass with 32400 failed
  </code></pre>
  
  <p>What can i do to evade this error?</p>