Method: Babik::QuerySet::AbstractAggregationFunction#prepare
- Defined in:
- lib/babik/queryset/components/aggregation.rb
#prepare(model, field_name = nil) ⇒ Object
Prepare the aggregation function for a model class and a field
54 55 56 57 58 59 |
# File 'lib/babik/queryset/components/aggregation.rb', line 54 def prepare(model, field_name = nil) @model = model @selection = Babik::Selection::Path::Factory.build(model, @aggregation_path) @field_name = field_name || "#{self.table_alias}__#{SQL_OPERATION.downcase}" self end |