aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-09-08 12:21:36 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-09-08 12:21:36 +0000
commiteec24a16c74248cf224f5cf9b233b7ede6eeb340 (patch)
treecb773d83401d1f6064ece8a70711dde19a6a1d01 /activerecord
parentbf92aacf40f946432dbe3c294e26b5516637b8a4 (diff)
downloadrails-eec24a16c74248cf224f5cf9b233b7ede6eeb340.tar.gz
rails-eec24a16c74248cf224f5cf9b233b7ede6eeb340.tar.bz2
rails-eec24a16c74248cf224f5cf9b233b7ede6eeb340.zip
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
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG4
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
2 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 2c60938bda..10b562362e 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,6 +1,8 @@
*SVN*
-* Added use_silence parameter to ActiveRecord::Base.benchmark that can be passed false to include all logging statements during the benchmark block
+* 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]
+
+* Added log_level and use_silence parameter to ActiveRecord::Base.benchmark. The first controls at what level the benchmark statement will be logged (now as debug, instead of info) and the second that can be passed false to include all logging statements during the benchmark block/
* Make sure the schema_info table is created before querying the current version #1903
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