diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-18 18:49:34 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-18 18:49:34 +0000 |
commit | 49d0f0cb66bc7b6d9cf69bd07b168669b3818cee (patch) | |
tree | 71b84270335a7dbcd7af6b0119654400fee9928c /activerecord/lib/active_record/base.rb | |
parent | 3b9bf64130df2512d058d841341d9a082493141e (diff) | |
download | rails-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-x | activerecord/lib/active_record/base.rb | 6 |
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: |