Class: ActiveRecord::HierarchicalQuery::JoinBuilder::SubqueryAlias
- Inherits:
-
Arel::Nodes::As
- Object
- Arel::Nodes::As
- ActiveRecord::HierarchicalQuery::JoinBuilder::SubqueryAlias
- Defined in:
- lib/active_record/hierarchical_query/join_builder.rb
Overview
This node is required to support joins to aliased Arel nodes
Instance Attribute Summary collapse
-
#table_name ⇒ Object
(also: #name)
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
-
#initialize(subquery, alias_node) ⇒ SubqueryAlias
constructor
A new instance of SubqueryAlias.
Constructor Details
#initialize(subquery, alias_node) ⇒ SubqueryAlias
Returns a new instance of SubqueryAlias.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/active_record/hierarchical_query/join_builder.rb', line 98 def initialize(subquery, alias_node) super @table_name = alias_node.try :name return unless alias_node.respond_to? :left aliased_name = alias_node.left.relation.name return if @table_name == aliased_name # Defensive coding; this shouldn't happen unless the # Rails team does a change to how Arel works. = "Unexpected alias name mismatch" raise RuntimeError, end |
Instance Attribute Details
#table_name ⇒ Object (readonly) Also known as: name
Returns the value of attribute table_name.
92 93 94 |
# File 'lib/active_record/hierarchical_query/join_builder.rb', line 92 def table_name @table_name end |