countする時groupでカラム別にcountする
#Userモデル
User(id: integer, email: string, status: integer)
# User.statuses
{"init"=>0, "using"=>1}
User.all.count
(233.9ms) SELECT COUNT(*) FROM `users`
=> 10
User.all.group(:status).count
(135.6ms) SELECT COUNT(*) AS count_all, `users`.`status` AS users_status FROM `users` GROUP BY `users`.`status`
=> {"init"=>4 "using"=>6}