In my model I have:
start = 3.weeks.ago
kliks = where(created_at: start.beginning_of_day..Time.zone.now)
kliks = kliks.group("date(created_at)")
How do I count all the records for each day as total?
I believe that this should work:
kliks = count(
:group => 'date(created_at)',
:conditions => { :created_at => start.beginning_of_day..Time.zone.now }
)
This will return you a hash mapping dates to their count.