blob: 7ec1fad27227759163522f777630125edf9968b4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module Arel
module Nodes
class TableAlias
attr_reader :name, :relation, :columns
alias :table_alias :name
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_sym
columns.find { |column| column.name == name }
end
end
end
end
|