Method: Babik::QuerySet::AbstractAggregationFunction#sql
- Defined in:
- lib/babik/queryset/components/aggregation.rb
#sql ⇒ String
Return aggregation function SQL
63 64 65 66 67 |
# File 'lib/babik/queryset/components/aggregation.rb', line 63 def sql selected_field_path = "#{@selection.target_alias}.#{@selection.selected_field}" operation = self.sql_operation.sub('?field', selected_field_path) "#{operation} AS #{@field_name}" end |