From eec24a16c74248cf224f5cf9b233b7ede6eeb340 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 8 Sep 2005 12:21:36 +0000 Subject: Fixed that Active Record would call SHOW FIELDS twice (or more) for the same model when the cached results were available #1947 [sd@notso.net] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2153 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 64f248cf90..22870a5263 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1389,7 +1389,7 @@ module ActiveRecord #:nodoc: # that a new instance, or one populated from a passed-in Hash, still has all the attributes # that instances loaded from the database would. def attributes_from_column_definition - connection.columns(self.class.table_name, "#{self.class.name} Columns").inject({}) do |attributes, column| + self.class.columns.inject({}) do |attributes, column| attributes[column.name] = column.default unless column.name == self.class.primary_key attributes end -- cgit v1.2.3