title: Iterating through date ranges
body: <p>Given this code:</p>
  
  <pre><code>def doc_chart_data(document)
    (1.month.ago.to_date..Date.today).map do |date| {
        date: date,
        hits: Impression.where(:impressionable_id =&gt; document).where(:created_at =&gt; date).count
        }
    end
  end
  </code></pre>
  
  <p>How would I change the <code>date</code> in the SQL query to be that <strong>whole</strong> day and not just a specific timestamp? There's all the date range answers with <code>Time.now</code> and all, but I don't really know how to write one in a situation where the dates are automatically mapped.</p>
  
  <p>Thanks!</p>