From d038a72bf3fb202d909337872467278586731411 Mon Sep 17 00:00:00 2001 From: Arthur Neves Date: Thu, 20 Feb 2014 10:34:08 -0500 Subject: Revert "speed up the collection proxy reader method, but slow down the constructor" This reverts commit f9e4c3c7c0c4152b62fe9202a9d12262884bb118. [fixes #14116] --- .../lib/active_record/associations/collection_association.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 03ca00fa70..89b7945c78 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -24,10 +24,6 @@ module ActiveRecord # If you need to work on all current children, new and existing records, # +load_target+ and the +loaded+ flag are your friends. class CollectionAssociation < Association #:nodoc: - def initialize(owner, reflection) - super - @proxy = CollectionProxy.create(klass, self) - end # Implements the reader method, e.g. foo.items for Foo.has_many :items def reader(force_reload = false) @@ -37,7 +33,7 @@ module ActiveRecord reload end - @proxy + @proxy ||= CollectionProxy.create(klass, self) end # Implements the writer method, e.g. foo.items= for Foo.has_many :items -- cgit v1.2.3