aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-04-09 15:46:56 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-04-09 15:46:56 -0700
commit4b187a19b16ed4cb0b248e4e4d658a4ef6e8f26e (patch)
tree8c4eb999336aa609bcfbbc7b47609da4f6bb934a /lib/arel
parent5703a965ad58c1f7515e389087ec2d1e73854028 (diff)
downloadrails-4b187a19b16ed4cb0b248e4e4d658a4ef6e8f26e.tar.gz
rails-4b187a19b16ed4cb0b248e4e4d658a4ef6e8f26e.tar.bz2
rails-4b187a19b16ed4cb0b248e4e4d658a4ef6e8f26e.zip
fix spacing so that Rails is happy
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/visitors/mysql.rb12
1 files changed, 9 insertions, 3 deletions
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