I am creating a report which looks for the number of emails sent during a period of time:
I display it in the View as follows:
<td><%= @emails_sent.size %></td>
And it is generated in the Controller as follows:
@sent_emails = ContactEmail.all(:conditions => ['date_sent >= ? and date_sent <= ?', @monday, @friday])
But sometimes now emails have been sent, which makes it nil, which causes the View to bonk.
What is the way to address this so that "nil" when the .find method comes up with nothing goes to a 0 instead of thinking it is 'nil?