From 703326cdc2e6ad426c09cfbf7983f893552ac845 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 14 Aug 2010 19:14:49 -0700 Subject: [PATCH] defaulting values to a list --- lib/arel/nodes/update_statement.rb | 2 +- lib/arel/visitors/to_sql.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/arel/nodes/update_statement.rb b/lib/arel/nodes/update_statement.rb index 3df54bb3a9..9f069cddb3 100644 --- a/lib/arel/nodes/update_statement.rb +++ b/lib/arel/nodes/update_statement.rb @@ -6,7 +6,7 @@ module Arel def initialize @relation = nil @wheres = [] - @values = nil + @values = [] end end end diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 9a9dd20d52..4c2a6a10e4 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -17,7 +17,7 @@ module Arel "UPDATE #{visit o.relation}", ("SET #{o.values.map { |column,value| "#{quote_column_name(column.name)} = #{quote visit value}" - }.join ', '}" if o.values), + }.join ', '}" unless o.values.empty?), ("WHERE #{o.wheres.map { |x| visit x }.join ' AND '}" unless o.wheres.empty?) ].compact.join ' ' end