aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2014-02-20 10:34:08 -0500
committerArthur Neves <arthurnn@gmail.com>2014-02-20 10:35:59 -0500
commitd038a72bf3fb202d909337872467278586731411 (patch)
tree794f24c3746a1801950677b45b74a925f6c4d825 /activerecord
parent17746181a31f18509687feeb03633ba8662c8036 (diff)
downloadrails-d038a72bf3fb202d909337872467278586731411.tar.gz
rails-d038a72bf3fb202d909337872467278586731411.tar.bz2
rails-d038a72bf3fb202d909337872467278586731411.zip
Revert "speed up the collection proxy reader method, but slow down the constructor"
This reverts commit f9e4c3c7c0c4152b62fe9202a9d12262884bb118. [fixes #14116]
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb6
1 files changed, 1 insertions, 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