From 4b187a19b16ed4cb0b248e4e4d658a4ef6e8f26e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 9 Apr 2014 15:46:56 -0700 Subject: fix spacing so that Rails is happy --- lib/arel/visitors/mysql.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/arel') diff --git a/lib/arel/visitors/mysql.rb b/lib/arel/visitors/mysql.rb index 70a37582c2..c4800f0466 100644 --- a/lib/arel/visitors/mysql.rb +++ b/lib/arel/visitors/mysql.rb @@ -54,18 +54,24 @@ module Arel collector << "UPDATE " collector = visit o.relation, collector + add_space = false + unless o.values.empty? - collector << " SET " + add_space = true + collector << "SET " collector = inject_join o.values, collector, ', ' end unless o.wheres.empty? - collector << " WHERE " + collector << ' ' if add_space + add_space = true + collector << "WHERE " collector = inject_join o.wheres, collector, ' AND ' end unless o.orders.empty? - collector << " ORDER BY " + collector << ' ' if add_space + collector << "ORDER BY " collector = inject_join o.orders, collector, ', ' end -- cgit v1.2.3