Module: ActsAsRecursiveTree::Builders::Strategies::Subselect

Defined in:
lib/acts_as_recursive_tree/builders/strategies/subselect.rb

Overview

Strategy for building a relation using an WHERE ID IN(…).

Class Method Summary collapse

Class Method Details

.build(builder) ⇒ ActiveRecord::Relation

Builds the relation.

Parameters:

Returns:

  • (ActiveRecord::Relation)


15
16
17
18
19
20
21
# File 'lib/acts_as_recursive_tree/builders/strategies/subselect.rb', line 15

def self.build(builder)
  builder.klass.where(
    builder.base_table[builder.primary_key].in(
      builder.create_select_manger(builder.primary_key)
    )
  )
end