title: Searching and Count records matching criteria in Rails
body: <p>I'm trying to keep from getting errors in datatables if my search criteria is coming up with empty results.  Is there a way to get a count of the number of rows that is going to be returned in a table?</p>
  
  <p>my table code looks like:</p>
  
  <pre><code>&lt;% @loads.each do |load| %&gt;
  &lt;% if load.trucker == current_trucker and (load.pickup_datetime &lt;= Date.today or load.current_status == "ON HOLD")  %&gt; 
  </code></pre>
  
  <p>I'd just like to have a line ahead which checks to see if it is going to return 1 or more rows (so I can eliminate the results if it is null).</p>
  
  <p>Any ideas? Go easy on me - I'm a hobby level guy.</p>
  
  <p>Thanks</p>