From f1217c605de2b089fd4fccb14c4d98b41a532c60 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 22 Jul 2016 13:03:41 +0900 Subject: No need to cache collection proxies separately Because merging the association scope was removed. --- .../lib/active_record/associations/collection_association.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index f747491a12..7d43a984d1 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -38,13 +38,7 @@ module ActiveRecord reload end - if null_scope? - # Cache the proxy separately before the owner has an id - # or else a post-save proxy will still lack the id - @null_proxy ||= CollectionProxy.create(klass, self) - else - @proxy ||= CollectionProxy.create(klass, self) - end + CollectionProxy.create(klass, self) end # Implements the writer method, e.g. foo.items= for Foo.has_many :items -- cgit v1.2.3