1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/lib/arel/crud.rb

35 lines
785 B
Ruby
Raw Normal View History

module Arel
###
# FIXME hopefully we can remove this
module Crud
# FIXME: this method should go away
def update values
um = UpdateManager.new @engine
2010-08-18 12:52:16 -04:00
if String === values
2010-08-19 13:37:50 -04:00
values = SqlLiteral.new values
2010-08-18 12:52:16 -04:00
um.table @ctx.froms.last
else
um.table values.first.first.relation
end
um.set values
um.wheres = @ctx.wheres
@engine.connection.execute um.to_sql
end
# FIXME: this method should go away
def insert values
im = InsertManager.new @engine
im.insert values
@engine.connection.execute im.to_sql
end
2010-08-18 14:32:44 -04:00
def delete
dm = DeleteManager.new @engine
dm.wheres = @ctx.wheres
dm.from @ctx.froms.last
@engine.connection.execute dm.to_sql
end
end
end