Class: ActiveRecord::HierarchicalQuery::JoinBuilder
- Inherits:
-
Object
- Object
- ActiveRecord::HierarchicalQuery::JoinBuilder
- Defined in:
- lib/active_record/hierarchical_query/join_builder.rb
Defined Under Namespace
Classes: SubqueryAlias
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(query, join_to, subquery_alias, options = {}) ⇒ JoinBuilder
constructor
A new instance of JoinBuilder.
Constructor Details
#initialize(query, join_to, subquery_alias, options = {}) ⇒ JoinBuilder
Returns a new instance of JoinBuilder.
10 11 12 13 14 15 16 |
# File 'lib/active_record/hierarchical_query/join_builder.rb', line 10 def initialize(query, join_to, subquery_alias, = {}) @query = query @builder = CTE::QueryBuilder.new(query, options: ) @relation = join_to @alias = Arel::Table.new(subquery_alias) @options = end |
Instance Method Details
#build ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/active_record/hierarchical_query/join_builder.rb', line 18 def build relation = @relation # add ordering by "__order_column" relation.order_values += order_columns if ordered? relation = relation.joins(joined_arel_node) return relation unless ActiveRecord.version < Gem::Version.new("5.2") relation.bind_values += bind_values relation end |