Module: ActiveRecord::Querying

Included in:
CTEProxy
Defined in:
lib/postgres_ext/active_record/querying.rb

Instance Method Summary collapse

Instance Method Details

#from_cte(name, expression) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/postgres_ext/active_record/querying.rb', line 4

def from_cte(name, expression)
  table = Arel::Table.new(name)

  cte_proxy = CTEProxy.new(name, self)
  relation = ActiveRecord::Relation.new cte_proxy, cte_proxy.arel_table
  relation.with name => expression
end