Module: Arel::Crud
- Included in:
- SelectManager, Table
- Defined in:
- activerecord/lib/arel/crud.rb
Overview
FIXME hopefully we can remove this
Instance Method Summary collapse
- #compile_delete ⇒ Object
- #compile_insert(values) ⇒ Object
- #compile_update(values, pk) ⇒ Object
- #create_insert ⇒ Object
Instance Method Details
#compile_delete ⇒ Object
34 35 36 37 38 39 40 |
# File 'activerecord/lib/arel/crud.rb', line 34 def compile_delete dm = DeleteManager.new dm.take @ast.limit.expr if @ast.limit dm.wheres = @ctx.wheres dm.from @ctx.froms dm end |
#compile_insert(values) ⇒ Object
24 25 26 27 28 |
# File 'activerecord/lib/arel/crud.rb', line 24 def compile_insert(values) im = create_insert im.insert values im end |
#compile_update(values, pk) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'activerecord/lib/arel/crud.rb', line 7 def compile_update(values, pk) um = UpdateManager.new if Nodes::SqlLiteral === values relation = @ctx.from else relation = values.first.first.relation end um.key = pk um.table relation um.set values um.take @ast.limit.expr if @ast.limit um.order(*@ast.orders) um.wheres = @ctx.wheres um end |
#create_insert ⇒ Object
30 31 32 |
# File 'activerecord/lib/arel/crud.rb', line 30 def create_insert InsertManager.new end |