Module: Pivotable::Pivoting
- Defined in:
- lib/pivotable/pivoting.rb
Instance Method Summary collapse
-
#pivot(*parts) ⇒ Object
Apply pivot retations.
Instance Method Details
#pivot(*parts) ⇒ Object
Apply pivot retations. Example:
Stat.pivot(:overall)
# Use custom (e.g. admin) rotation
Stat.pivot(:admin, :by_day)
# Same as
Stat.pivot("admin:by_day")
# Combine it with relations & scopes
Stat.latest.order('some_column').pivot(:by_day).paginate :page => 1
16 17 18 |
# File 'lib/pivotable/pivoting.rb', line 16 def pivot(*parts) klass.pivotable(*parts).merge(self) end |