diff options
Diffstat (limited to 'lib/arel/engines/sql')
-rw-r--r-- | lib/arel/engines/sql/christener.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/arel/engines/sql/christener.rb b/lib/arel/engines/sql/christener.rb index 3c7fb0425e..b30883e47c 100644 --- a/lib/arel/engines/sql/christener.rb +++ b/lib/arel/engines/sql/christener.rb @@ -8,11 +8,11 @@ module Arel def name_for(relation) table = relation.table name = table.table_alias || table.name - @names[name] ||= [] + list = @names[name] ||= [] - @names[name] << table unless @names[name].include? table + list << table unless list.include? table - idx = @names[name].index table + idx = list.index table name + (idx == 0 ? '' : "_#{idx + 1}") end end |