aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-12 21:40:38 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-12 21:40:38 +0530
commit7286f0f4c8117e2210834070d30378ffb12dba23 (patch)
tree3a146b5efe6bee24e6d1bd5a8348e792582207b4 /lib
parent26a0fefc6d87107161a0d3a171d852f6cd2b4888 (diff)
downloadrails-7286f0f4c8117e2210834070d30378ffb12dba23.tar.gz
rails-7286f0f4c8117e2210834070d30378ffb12dba23.tar.bz2
rails-7286f0f4c8117e2210834070d30378ffb12dba23.zip
Make sure not to use alias if it's same as the table name
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/engines/sql/relations/table.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/arel/engines/sql/relations/table.rb b/lib/arel/engines/sql/relations/table.rb
index 6ad294dc6c..0634436280 100644
--- a/lib/arel/engines/sql/relations/table.rb
+++ b/lib/arel/engines/sql/relations/table.rb
@@ -11,7 +11,7 @@ module Arel
if options.is_a?(Hash)
@options = options
@engine = options[:engine] || Table.engine
- @table_alias = options[:as].to_s if options[:as].present?
+ @table_alias = options[:as].to_s if options[:as].present? && options[:as].to_s != @name
else
@engine = options # Table.new('foo', engine)
end