I'm writing a scope to group PageView's by created_at date and then retrieving the count for each date. Here is my scope:
scope :count_by_date, -> { group('date(created_at)').count }
This returns the counts in this format:
{Wed, 26 Aug 2020=>3, Tue, 25 Aug 2020=>8}
I'm then using this data with Chart.js to create various charts in my app. The issue I'm having is I need the hash returned from the scope to be in this format so I can use the keys and values as the charts x and y values:
{"2020-08-26"=>3, "2020-08-25"=>8}
How can I get the data back in the format I need?