title: Calculate Month Statistics
body: <p>I have a donations table where I'm trying to calculate the total amount for each month. For months without without any donations, I'd like the result to return 0.</p>
  
  <p>Here's my current query:</p>
  
  <pre><code>Donation.calculate(:sum, :amount, :conditions =&gt; { 
    :created_at =&gt; (Time.now.prev_year.all_year) }, 
    :order =&gt; "EXTRACT(month FROM created_at)", 
    :group =&gt; ["EXTRACT(month FROM created_at)"])
  </code></pre>
  
  <p>which returns:</p>
  
  <pre><code>{7=&gt;220392, 8=&gt;334210, 9=&gt;475188, 10=&gt;323661, 11=&gt;307689, 12=&gt;439889}
  </code></pre>
  
  <p>Any ideas how to grab the empty months?</p>