How to get records by month
<p>I have tried several solutions but the only one close enough to what i want is this</p>

<pre><code>Sale.all.group("DATE_TRUNC('month', created_at)").count
</code></pre>

<p>but it returns something like this</p>

<p><code>{2016-07-01 00:00:00 UTC=&gt;19, 2016-04-01 00:00:00 UTC=&gt;70}</code></p>

<p>is there something that can do this format?</p>

<p><code>[month,number of sales]</code> ??</p>

<p>using postgres db.</p>