Skip to content
Browse files

Revert "speed up the collection proxy reader method, but slow down th…

…e constructor"

This reverts commit f9e4c3c.

[fixes #14116]
  • Loading branch information...
1 parent 1774618 commit d038a72bf3fb202d909337872467278586731411 @arthurnn arthurnn committed Feb 20, 2014
Showing with 1 addition and 5 deletions.
  1. +1 −5 activerecord/lib/active_record/associations/collection_association.rb
View
6 activerecord/lib/active_record/associations/collection_association.rb
@@ -24,10 +24,6 @@ module Associations
# 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 @@ def reader(force_reload = false)
reload
end
- @proxy
+ @proxy ||= CollectionProxy.create(klass, self)
end
# Implements the writer method, e.g. foo.items= for Foo.has_many :items

0 comments on commit d038a72

Please sign in to comment.
Something went wrong with that request. Please try again.