words.tally #=> {"the"=>12, "and"=>7} orders.group_by(&:status) .transform_values(&:count)