I want to summarize all the elements (for example, price) from a table column, where some values (type) are equal to some parameter (1):
Table
id type price ------------- 1 1 10 2 1 8 3 2 7 4 1 2
I think it could be like this:
Table.where(:type => 1). ???
I need to get 20.
source share