Rails - grouping by day for the last week, and adding them together
I'm trying to create an array that has the total of all sales a company
does for each day of the week. Right now I have something similar to this
@sales = Sale.all
@sales_total = @sales.map{|sale|sale.total.to_i}
Which returns an array of each total for every single sale.
Before turning it into an array, how can I group Sale by day, and adding
total together?
No comments:
Post a Comment