How can I get records from a database and the amount of each record using active record interface? For example I have
field_1, value_1
field_1, value_2
field_1, value_3
field_1, value_1
field_1, value_2
I should get
value_1, 2
value_2, 2
value_3, 1
You can do it this way