Class: Pivotable::Expression::Generic
- Inherits:
-
Abstract
- Object
- Abstract
- Pivotable::Expression::Generic
show all
- Defined in:
- lib/pivotable/expression/generic.rb
Instance Attribute Summary
Attributes inherited from Abstract
#model, #name, #via
Instance Method Summary
collapse
Methods inherited from Abstract
#initialize
Instance Method Details
#to_group ⇒ Object
13
14
15
|
# File 'lib/pivotable/expression/generic.rb', line 13
def to_group
via.clone
end
|
#to_select ⇒ Object
3
4
5
6
7
8
9
10
11
|
# File 'lib/pivotable/expression/generic.rb', line 3
def to_select
case via
when String
"#{via} AS #{name}"
else
sql = Arel::Visitors.visitor_for(model.arel_table.engine).accept via
"#{sql} AS #{name}"
end
end
|