Module: NoBrainer::Criteria::Aggregate
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/no_brainer/criteria/aggregate.rb
Instance Method Summary collapse
Instance Method Details
#avg(*a, &b) ⇒ Object
16 17 18 |
# File 'lib/no_brainer/criteria/aggregate.rb', line 16 def avg(*a, &b) run { aggregate_rql(:avg, *a, &b) } end |
#max(*a, &b) ⇒ Object
8 9 10 |
# File 'lib/no_brainer/criteria/aggregate.rb', line 8 def max(*a, &b) order_by(a, &b).last end |
#min(*a, &b) ⇒ Object
4 5 6 |
# File 'lib/no_brainer/criteria/aggregate.rb', line 4 def min(*a, &b) order_by(a, &b).first end |
#sum(*a, &b) ⇒ Object
12 13 14 |
# File 'lib/no_brainer/criteria/aggregate.rb', line 12 def sum(*a, &b) run { aggregate_rql(:sum, *a, &b) } end |