Class: ActiveRecord::HierarchicalQuery::CTE::RecursiveTerm

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ RecursiveTerm

Returns a new instance of RecursiveTerm.



11
12
13
# File 'lib/active_record/hierarchical_query/cte/recursive_term.rb', line 11

def initialize(builder)
  @builder = builder
end

Instance Attribute Details

#builderActiveRecord::HierarchicalQuery::CTE::Query (readonly)

Returns:

  • (ActiveRecord::HierarchicalQuery::CTE::Query)


6
7
8
# File 'lib/active_record/hierarchical_query/cte/recursive_term.rb', line 6

def builder
  @builder
end

Instance Method Details

#arelObject



25
26
27
28
29
30
# File 'lib/active_record/hierarchical_query/cte/recursive_term.rb', line 25

def arel
  arel = scope.arel
              .join(query.recursive_table).on(query.join_conditions)

  builder.cycle_detector.apply_to_recursive(arel)
end

#bind_valuesObject



16
17
18
# File 'lib/active_record/hierarchical_query/cte/recursive_term.rb', line 16

def bind_values
  scope.bound_attributes
end