If number of records = zero, display 'no records found'

Well, for starters, not showing enough of your code, but I'll take a shot anyway.

<% if @runs.blank? -%>
   <p>No rows found</p>
<% else -%>
   <% for run in @runs -%>
     <%= row_for(run) %>
   <% end -%>
<% end -%>

Since .blank? works with nil, it avoids possible issues with nil.size == 0 (which is better expressed as @runs.empty? anyway).


Rob Biedenharn http://agileconsultingllc.com

Post your code. Otherwise, everyone's just guessing.