I\'m on Ruby 1.9.2, Rails 3.0.x and I use MySQL DB. I have a Messages Model, where one can post new messages every day.
I have an index action where I want to display t
To group by year and by month (e.g. not having december 2020 with december 2021):
Message.group("date_trunc('year', created_at), date_trunc('month', created_at)")
Tested on PostgreSQL