Module: ActiveRecord::Refined::AST::Windowing

Included in:
Aggregate, Function, JsonAggregate, StringAggregate
Defined in:
lib/active_record/refined/ast.rb

Overview

OVER, on the two things that can carry a window: an aggregate, and a function.

Instance Method Summary collapse

Instance Method Details

#overAST::Over

OVER (), an empty window to be filled by Over#partition, Over#order, Over#rows and Over#range.

Examples:

Author.select { avg(:age).over.partition(:country).as(:country_average) }
Post.select { sum(:likes).over.order(:created_at).rows(..0).as(:running) }

Returns:



1492
1493
1494
# File 'lib/active_record/refined/ast.rb', line 1492

def over
  Over.new(self)
end