9
отсылая к этому: Is there any difference between GROUP BY and DISTINCTGROUP BY и COUNT с помощью ActiveRecord
Given a table that looks like this:
name
------
barry
dave
bill
dave
dave
barry
john
This query:
SELECT name, count(*) AS count FROM table GROUP BY name;
Will produce output like this:
name count
-------------
barry 2
dave 3
bill 1
john 1
Как правильно Rails условность здесь ActiveModel выполнить GROUP BY с COUNT?
'Table.all.group (: name) .count' –