diff --git a/lib/arel/table.rb b/lib/arel/table.rb index b4b4a861b8..0e7214f269 100644 --- a/lib/arel/table.rb +++ b/lib/arel/table.rb @@ -6,7 +6,7 @@ module Arel @engine = nil class << self; attr_accessor :engine; end - attr_accessor :name, :aliases, :table_alias + attr_accessor :name, :table_alias # TableAlias and Table both have a #table_name which is the name of the underlying table alias :table_name :name @@ -14,7 +14,6 @@ module Arel def initialize(name, as: nil, type_caster: nil) @name = name.to_s @columns = nil - @aliases = [] @type_caster = type_caster # Sometime AR sends an :as parameter to table, to let the table know @@ -27,9 +26,7 @@ module Arel end def alias name = "#{self.name}_2" - Nodes::TableAlias.new(self, name).tap do |node| - @aliases << node - end + Nodes::TableAlias.new(self, name) end def from @@ -94,7 +91,6 @@ module Arel def eql? other self.class == other.class && self.name == other.name && - self.aliases == other.aliases && self.table_alias == other.table_alias end alias :== :eql? diff --git a/test/test_table.rb b/test/test_table.rb index e8eaf901cc..168fde370d 100644 --- a/test/test_table.rb +++ b/test/test_table.rb @@ -110,10 +110,7 @@ module Arel describe 'alias' do it 'should create a node that proxies to a table' do - @relation.aliases.must_equal [] - node = @relation.alias - @relation.aliases.must_equal [node] node.name.must_equal 'users_2' node[:id].relation.must_equal node end @@ -191,10 +188,8 @@ module Arel describe 'equality' do it 'is equal with equal ivars' do relation1 = Table.new(:users) - relation1.aliases = %w[a b c] relation1.table_alias = 'zomg' relation2 = Table.new(:users) - relation2.aliases = %w[a b c] relation2.table_alias = 'zomg' array = [relation1, relation2] assert_equal 1, array.uniq.size @@ -202,11 +197,9 @@ module Arel it 'is not equal with different ivars' do relation1 = Table.new(:users) - relation1.aliases = %w[a b c] relation1.table_alias = 'zomg' relation2 = Table.new(:users) - relation2.aliases = %w[x y z] - relation2.table_alias = 'zomg' + relation2.table_alias = 'zomg2' array = [relation1, relation2] assert_equal 2, array.uniq.size end