aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-05-28 18:24:40 -0300
committerEmilio Tagua <miloops@gmail.com>2009-05-28 18:24:40 -0300
commitdc09a633c37ca0b214e4d1dd1572cdb9070fc38d (patch)
treea1367660e6a820f6c0f9e2a960ab676293cd6cdf /lib
parent054b0103a8a833e643c954fb31b9a5d88e29968e (diff)
downloadrails-dc09a633c37ca0b214e4d1dd1572cdb9070fc38d.tar.gz
rails-dc09a633c37ca0b214e4d1dd1572cdb9070fc38d.tar.bz2
rails-dc09a633c37ca0b214e4d1dd1572cdb9070fc38d.zip
Don't quote the table if it isn't a table name. By doing this Arel supports using custom SQL FROM like: edges USE INDEX(unique_edge_index)
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/engines/sql/formatters.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/arel/engines/sql/formatters.rb b/lib/arel/engines/sql/formatters.rb
index 22935ebff1..626803a887 100644
--- a/lib/arel/engines/sql/formatters.rb
+++ b/lib/arel/engines/sql/formatters.rb
@@ -91,8 +91,12 @@ module Arel
end
def table(table)
- quote_table_name(table.name) +
- (table.name != name_for(table) ? " AS " + quote_table_name(name_for(table)) : '')
+ if table.name =~ /\s/
+ table.name
+ else
+ quote_table_name(table.name) +
+ (table.name != name_for(table) ? " AS " + quote_table_name(name_for(table)) : '')
+ end
end
end