Class: ActiveRecord::Refined::AST::Node
- Inherits:
-
Object
- Object
- ActiveRecord::Refined::AST::Node
show all
- Defined in:
- lib/active_record/refined/ast.rb
Direct Known Subclasses
Aggregate, Arithmetic, As, Bitwise, BitwiseNot, Case, Case::Pending, Cast, Column, DatetimeValueFunction, Extract, Function, GroupingSets, JsonPath, JsonSet, Ordering, Over, Predicate, Quantified, Value
Instance Method Summary
collapse
Instance Method Details
#as(alias_name, quote: true) ⇒ Object
307
308
309
|
# File 'lib/active_record/refined/ast.rb', line 307
def as(alias_name, quote: true)
As.new(self, alias_name, quote: quote)
end
|
#asc ⇒ Object
311
312
313
|
# File 'lib/active_record/refined/ast.rb', line 311
def asc
Ordering.new(self, :asc)
end
|
#desc ⇒ Object
315
316
317
|
# File 'lib/active_record/refined/ast.rb', line 315
def desc
Ordering.new(self, :desc)
end
|
#to_arel(table, model) ⇒ Object
The model travels with the table because some SQL cannot be written
without knowing the adapter, and a node is built before anything
knows which one it will be rendered for -- a symbol becomes a node
inside a refinement, where there is no model to ask. Most nodes
never look at it and only pass it on.
303
304
305
|
# File 'lib/active_record/refined/ast.rb', line 303
def to_arel(table, model)
raise ScriptError, "subclass must override this method"
end
|