diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-24 12:01:05 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-24 12:01:05 -0800 |
commit | f092ae544f58255508242a5308c456d9b8a13b0c (patch) | |
tree | a41093079fc4333bd5126e4158495452be24ba28 /lib/arel/nodes | |
parent | 6667cfb995a49bffe66231a7ffc5a78ca7f5140f (diff) | |
download | rails-f092ae544f58255508242a5308c456d9b8a13b0c.tar.gz rails-f092ae544f58255508242a5308c456d9b8a13b0c.tar.bz2 rails-f092ae544f58255508242a5308c456d9b8a13b0c.zip |
make table aliases cheaper to allocate
Diffstat (limited to 'lib/arel/nodes')
-rw-r--r-- | lib/arel/nodes/table_alias.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/arel/nodes/table_alias.rb b/lib/arel/nodes/table_alias.rb index 7ec1fad272..60da7b19f3 100644 --- a/lib/arel/nodes/table_alias.rb +++ b/lib/arel/nodes/table_alias.rb @@ -1,20 +1,16 @@ module Arel module Nodes class TableAlias - attr_reader :name, :relation, :columns + attr_reader :name, :relation 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 } + Attribute.new self, name end end end |