lib/arel/engines/sql/relations/table.rb in arel-0.3.3 vs lib/arel/engines/sql/relations/table.rb in arel-0.4.0
- old
+ new
@@ -40,15 +40,18 @@
end
def attributes
return @attributes if defined?(@attributes)
if table_exists?
- @attributes = columns.collect do |column|
- Sql::Attributes.for(column).new(column, self, column.name.to_sym)
+ @attributes ||= begin
+ attrs = columns.collect do |column|
+ Sql::Attributes.for(column).new(column, self, column.name.to_sym)
+ end
+ Header.new(attrs)
end
else
- []
+ Header.new
end
end
def eql?(other)
self == other
@@ -65,10 +68,11 @@
def columns
@columns ||= engine.columns(name, "#{name} Columns")
end
def reset
- @attributes = @columns = nil
+ @columns = nil
+ @attributes = Header.new([])
end
def ==(other)
Table === other and
name == other.name and