Module: Babik::QuerySet::Aggregatable
- Included in:
- AbstractBase
- Defined in:
- lib/babik/queryset/mixins/aggregatable.rb
Overview
Functionality related to the aggregation selection
Instance Method Summary collapse
-
#aggregate(agg_functions) ⇒ Hash{symbol: float}
Aggregate a set of objects.
Instance Method Details
#aggregate(agg_functions) ⇒ Hash{symbol: float}
Aggregate a set of objects.
10 11 12 13 14 |
# File 'lib/babik/queryset/mixins/aggregatable.rb', line 10 def aggregate(agg_functions) @_aggregation = Babik::QuerySet::Aggregation.new(@model, agg_functions) select_sql = sql.select self.class._execute_sql(select_sql).first.transform_values(&:to_f).symbolize_keys end |