aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNihad Abbasov <narkoz.2008@gmail.com>2013-04-17 18:13:29 +0500
committerNihad Abbasov <narkoz.2008@gmail.com>2014-11-26 22:52:35 +0400
commit8572455d4cf7a61462bde7cef2d3724685c1c44c (patch)
treeed6dcd74bb8e1a780dc62fb9546da95c9e8d1c5e
parent1fefe71b1872c0a83f09231164863cd8dbb57174 (diff)
downloadrails-8572455d4cf7a61462bde7cef2d3724685c1c44c.tar.gz
rails-8572455d4cf7a61462bde7cef2d3724685c1c44c.tar.bz2
rails-8572455d4cf7a61462bde7cef2d3724685c1c44c.zip
remove extra space before 'ORDER BY'
-rw-r--r--lib/arel/visitors/to_sql.rb1
-rw-r--r--test/visitors/test_to_sql.rb9
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index 884076d987..30c8634119 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -211,7 +211,6 @@ module Arel
}
unless o.orders.empty?
- collector << SPACE
collector << ORDER_BY
len = o.orders.length - 1
o.orders.each_with_index { |x, i|
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index 2e3f7f8624..04fca8024b 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -181,6 +181,13 @@ module Arel
assert_match(/LIMIT 'omg'/, compile(sc))
end
+ it "should contain a single space before ORDER BY" do
+ table = Table.new(:users)
+ test = table.order(table[:name])
+ sql = compile test
+ assert_match(/"users" ORDER BY/, sql)
+ end
+
it "should quote LIMIT without column type coercion" do
table = Table.new(:users)
sc = table.where(table[:name].eq(0)).take(1).ast
@@ -291,7 +298,7 @@ module Arel
end
it "should visit_Arel_Nodes_Assignment" do
- column = @table["id"]
+ column = @table["id"]
node = Nodes::Assignment.new(
Nodes::UnqualifiedColumn.new(column),
Nodes::UnqualifiedColumn.new(column)