aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-18 18:49:34 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-18 18:49:34 +0000
commit49d0f0cb66bc7b6d9cf69bd07b168669b3818cee (patch)
tree71b84270335a7dbcd7af6b0119654400fee9928c /activerecord/lib/active_record/base.rb
parent3b9bf64130df2512d058d841341d9a082493141e (diff)
downloadrails-49d0f0cb66bc7b6d9cf69bd07b168669b3818cee.tar.gz
rails-49d0f0cb66bc7b6d9cf69bd07b168669b3818cee.tar.bz2
rails-49d0f0cb66bc7b6d9cf69bd07b168669b3818cee.zip
Speeded up eager loading a whole bunch
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1212 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index e14eff594a..a173a16eee 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -618,6 +618,10 @@ module ActiveRecord #:nodoc:
def columns_hash
@columns_hash ||= columns.inject({}) { |hash, column| hash[column.name] = column; hash }
end
+
+ def column_names
+ @column_names ||= columns_hash.keys
+ end
# Returns an array of columns objects where the primary id, all columns ending in "_id" or "_count",
# and columns used for single table inheritance has been removed.
@@ -640,7 +644,7 @@ module ActiveRecord #:nodoc:
# Resets all the cached information about columns, which will cause they to be reloaded on the next request.
def reset_column_information
- @columns = @columns_hash = @content_columns = @dynamic_methods_hash = nil
+ @column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = nil
end
def reset_column_information_and_inheritable_attributes_for_all_subclasses#:nodoc: