Class: Arel::DeleteManager
- Inherits:
-
TreeManager
- Object
- TreeManager
- Arel::DeleteManager
- Includes:
- TreeManager::StatementMethods
- Defined in:
- activerecord/lib/arel/delete_manager.rb
Instance Attribute Summary
Attributes inherited from TreeManager
Instance Method Summary collapse
- #comment(value) ⇒ Object
- #from(relation) ⇒ Object
- #group(columns) ⇒ Object
- #having(expr) ⇒ Object
-
#initialize(table = nil) ⇒ DeleteManager
constructor
A new instance of DeleteManager.
Methods included from TreeManager::StatementMethods
#key, #key=, #offset, #order, #take, #where, #wheres=
Methods inherited from TreeManager
#initialize_copy, #to_dot, #to_sql
Methods included from FactoryMethods
#cast, #coalesce, #create_and, #create_false, #create_join, #create_on, #create_string_join, #create_table_alias, #create_true, #grouping, #lower
Constructor Details
#initialize(table = nil) ⇒ DeleteManager
Returns a new instance of DeleteManager.
7 8 9 10 11 |
# File 'activerecord/lib/arel/delete_manager.rb', line 7 def initialize(table = nil) super @ast = Nodes::DeleteStatement.new(table) end |
Instance Method Details
#comment(value) ⇒ Object
34 35 36 37 |
# File 'activerecord/lib/arel/delete_manager.rb', line 34 def comment(value) @ast.comment = value self end |
#from(relation) ⇒ Object
13 14 15 16 |
# File 'activerecord/lib/arel/delete_manager.rb', line 13 def from(relation) @ast.relation = relation self end |
#group(columns) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'activerecord/lib/arel/delete_manager.rb', line 18 def group(columns) columns.each do |column| column = Nodes::SqlLiteral.new(column) if String === column column = Nodes::SqlLiteral.new(column.to_s) if Symbol === column @ast.groups.push Nodes::Group.new column end self end |
#having(expr) ⇒ Object
29 30 31 32 |
# File 'activerecord/lib/arel/delete_manager.rb', line 29 def having(expr) @ast.havings << expr self end |