Class: ActiveRecord::HierarchicalQuery::CTE::UnionTerm

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/hierarchical_query/cte/union_term.rb

Instance Method Summary collapse

Constructor Details

#initialize(builder, options = {}) ⇒ UnionTerm

Returns a new instance of UnionTerm.



9
10
11
12
# File 'lib/active_record/hierarchical_query/cte/union_term.rb', line 9

def initialize(builder, options = {})
  @builder = builder
  @union_type = options.fetch(:union_type, :all)
end

Instance Method Details

#arelObject



26
27
28
# File 'lib/active_record/hierarchical_query/cte/union_term.rb', line 26

def arel
  non_recursive_term.arel.union(union_type, recursive_term.arel)
end

#bind_valuesObject



15
16
17
# File 'lib/active_record/hierarchical_query/cte/union_term.rb', line 15

def bind_values
  non_recursive_term.bind_values + recursive_term.bind_values
end