diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-06 14:05:01 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-06 14:05:01 -0700 |
commit | 12ba765448582cb86e5f57d6befc42c59eb295d9 (patch) | |
tree | cb78d5aef4667209526d927ee60621dee1ab2c1c | |
parent | bbc42ff03d60fca1d51791399ae7041fa20e4185 (diff) | |
download | rails-12ba765448582cb86e5f57d6befc42c59eb295d9.tar.gz rails-12ba765448582cb86e5f57d6befc42c59eb295d9.tar.bz2 rails-12ba765448582cb86e5f57d6befc42c59eb295d9.zip |
initializing instance variables
-rw-r--r-- | lib/arel/engines/sql/relations/table.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/arel/engines/sql/relations/table.rb b/lib/arel/engines/sql/relations/table.rb index 35b6b5ce5c..dd9000d660 100644 --- a/lib/arel/engines/sql/relations/table.rb +++ b/lib/arel/engines/sql/relations/table.rb @@ -21,6 +21,8 @@ module Arel @table_exists = nil @table_alias = nil @christener = Sql::Christener.new + @attributes = nil + @matching_attributes = nil if options.is_a?(Hash) @options = options @@ -57,14 +59,12 @@ module Arel end def attributes - return @attributes if defined?(@attributes) + return @attributes if @attributes if table_exists? - @attributes ||= begin - attrs = columns.collect do |column| - Sql::Attributes.for(column).new(column, self, column.name.to_sym) - end - Header.new(attrs) + attrs = columns.collect do |column| + Sql::Attributes.for(column).new(column, self, column.name.to_sym) end + @attributes = Header.new(attrs) else Header.new end |