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
14
15
16
|
# File 'lib/pivotable/expression/generic.rb', line 14
def to_group
via.clone
end
|
#to_select ⇒ Object
3
4
5
6
7
8
9
10
11
12
|
# File 'lib/pivotable/expression/generic.rb', line 3
def to_select
case via
when String
"#{via} AS #{name}"
else
via.as(name).to_sql.tap do |s|
s.sub!(/AS .+$/, "AS #{name}") if Arel::VERSION < "2.1.0"
end
end
end
|