aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-26 14:29:21 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-26 14:29:21 -0700
commit82e0b8dd85a82fc9907f96bb1af849453a87b01a (patch)
treee4cac8ab6008bda91e6564ebdcb8a02b9162a839 /lib/arel/algebra
parentd2092e7e0bb5260bd02d9eeea4decf7efa34e29c (diff)
downloadrails-82e0b8dd85a82fc9907f96bb1af849453a87b01a.tar.gz
rails-82e0b8dd85a82fc9907f96bb1af849453a87b01a.tar.bz2
rails-82e0b8dd85a82fc9907f96bb1af849453a87b01a.zip
reorganizing more classes
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r--lib/arel/algebra/relations/writes.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/arel/algebra/relations/writes.rb b/lib/arel/algebra/relations/writes.rb
index 17da2b172b..8cf7a7cdad 100644
--- a/lib/arel/algebra/relations/writes.rb
+++ b/lib/arel/algebra/relations/writes.rb
@@ -9,6 +9,10 @@ module Arel
def call
engine.delete(self)
end
+
+ def to_sql
+ compiler.delete_sql
+ end
end
class Insert < Action
@@ -26,6 +30,14 @@ module Arel
def == other
super && @record == other.record
end
+
+ def eval
+ unoperated_rows + [Row.new(self, record.values.collect(&:value))]
+ end
+
+ def to_sql(include_returning = true)
+ compiler.insert_sql(include_returning)
+ end
end
class Update < Insert
@@ -34,5 +46,9 @@ module Arel
def call
engine.update(self)
end
+
+ def to_sql
+ compiler.update_sql
+ end
end
end