Module: Returning::Rails31::Arel::Crud
- Defined in:
- lib/returning/rails31/arel/crud.rb
Instance Method Summary collapse
Instance Method Details
#compile_delete ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/returning/rails31/arel/crud.rb', line 22 def compile_delete dm = ::Arel::DeleteManager.new @engine dm.wheres = @ctx.wheres dm.from @ctx.froms dm.returning @ctx.returnings if @ctx.returnings dm end |
#compile_update(values) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/returning/rails31/arel/crud.rb', line 5 def compile_update values um = ::Arel::UpdateManager.new @engine if ::Arel::Nodes::SqlLiteral === values relation = @ctx.from else relation = values.first.first.relation end um.table relation um.set values um.take @ast.limit.expr if @ast.limit um.order(*@ast.orders) um.wheres = @ctx.wheres um.returning @ctx.returnings if @ctx.returnings um end |