I'm trying to group quotes sum per month, while adding last sums.
For example:
Jan: 300€
Fev: 200€
Mars: 100€
What the group should return is:
Jan:300€
Fev: 500€ (200 + Jan's 300)
Mars: 600€ (100 + Fev's 500)
Current SQL:
current_user.quotes.group_by_month(:created_at, last: 12).sum(:price)
I'm using the groupdate
gem.
Thanks.