I've got a table that looks like this
I want to display the amount of entries by a certain agent. I know I can use e.g.
orders.sum(:demand)
to sum up the demand. (table is called orders) However, there has to be a way to sum up the entries right? E.g. for agent 1, this would be 4, for agent 2 it would be 1 and for agent 3 it would be 4 entries (as can be seen in the screenshot).
Any ideas?