aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/visitors
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-08-14 18:29:32 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-08-14 18:29:32 -0700
commitdddf2d1f095230fde5e8704632df1ecca54e5ca6 (patch)
tree29386e06582ed029cf94218a87b7f71d88866254 /lib/arel/visitors
parent74a27a0d83ecd7ed4975851ea92ee517a1581faf (diff)
downloadrails-dddf2d1f095230fde5e8704632df1ecca54e5ca6.tar.gz
rails-dddf2d1f095230fde5e8704632df1ecca54e5ca6.tar.bz2
rails-dddf2d1f095230fde5e8704632df1ecca54e5ca6.zip
basic updates are working
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r--lib/arel/visitors/to_sql.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index d47c621f6a..41d1299948 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -12,6 +12,13 @@ module Arel
end
private
+ def visit_Arel_Nodes_UpdateStatement o
+ [
+ "UPDATE #{visit o.relation}",
+ ("WHERE #{o.wheres.map { |x| visit x }.join ' AND '}" unless o.wheres.empty?)
+ ].compact.join ' '
+ end
+
def visit_Arel_Nodes_InsertStatement o
[
"INSERT INTO #{visit o.relation}",