ActiveRecordで日付単位でのdistinct



Message.all.group_by { |m| m.created_at.beginning_of_month }

なるほど。