This SO question How do I group by day instead of date? shows how to group in Ruby.
This works, but is going to be very slow for a large number of records.
How to do it so that the grouping and counting by :created_at
by day happens within Postgres?