1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
module Arel module Nodes class TableAlias attr_reader :name, :relation, :columns def initialize name, relation @name = name @relation = relation @columns = relation.columns.map { |column| column.dup.tap { |col| col.relation = self } } end def [] name name = name.to_s columns.find { |column| column.name == name } end end end end