aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2013-03-15 13:46:39 +0000
committerJon Leighton <j@jonathanleighton.com>2013-03-15 13:48:45 +0000
commit133a1759a4c317e7836699bba2530603a84d7ccb (patch)
treeace4f14deaff55765ed4509066223032d9a7de43 /activerecord/lib
parent0721d3b37062eca73da3efd669142d7e381e4d80 (diff)
downloadrails-133a1759a4c317e7836699bba2530603a84d7ccb.tar.gz
rails-133a1759a4c317e7836699bba2530603a84d7ccb.tar.bz2
rails-133a1759a4c317e7836699bba2530603a84d7ccb.zip
Cache the association proxy object
This reimplements the behaviour of Rails 3, as I couldn't see why we shouldn't cache the object, and @alindeman had a good use case for caching it: https://github.com/rails/rails/commit/c86a32d7451c5d901620ac58630460915292f88b#commitcomment-2784312
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb
index 18b7dc3668..906560bd44 100644
--- a/activerecord/lib/active_record/associations/collection_association.rb
+++ b/activerecord/lib/active_record/associations/collection_association.rb
@@ -34,7 +34,7 @@ module ActiveRecord
reload
end
- CollectionProxy.new(klass, self)
+ @proxy ||= CollectionProxy.new(klass, self)
end
# Implements the writer method, e.g. foo.items= for Foo.has_many :items