Class: ActiveRecord::Refined::AST::Exists
- Defined in:
- lib/active_record/refined/ast.rb
Overview
EXISTS (SELECT ...) for a relation. Correlate the subquery with the outer table through qualified columns. EXISTS only asks whether a row comes back, so unlike In there is no select list to fix up.
Instance Attribute Summary collapse
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Instance Method Summary collapse
-
#initialize(relation) ⇒ Exists
constructor
A new instance of Exists.
- #to_arel(_table) ⇒ Object
Methods inherited from Predicate
Methods inherited from Node
Constructor Details
#initialize(relation) ⇒ Exists
Returns a new instance of Exists.
283 284 285 |
# File 'lib/active_record/refined/ast.rb', line 283 def initialize(relation) @relation = relation end |
Instance Attribute Details
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
281 282 283 |
# File 'lib/active_record/refined/ast.rb', line 281 def relation @relation end |
Instance Method Details
#to_arel(_table) ⇒ Object
287 288 289 290 291 292 293 |
# File 'lib/active_record/refined/ast.rb', line 287 def to_arel(_table) subquery = relation if subquery.eager_loading? subquery = subquery.send(:apply_join_dependency) end subquery.arel.exists end |