diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2018-11-27 10:58:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-27 10:58:10 -0500 |
commit | f2ab8b64d4d46d7199f94c3e21021f414a4d259a (patch) | |
tree | e34136973b1cdf9092a8d55bf080984d8deb43bd /activerecord/lib/active_record/associations/collection_association.rb | |
parent | b9c7305dbe57931a153a540d49ae5d469af61a14 (diff) | |
parent | 68acbe8a3a1d5b2fab85ba9268645f6a1ceafff2 (diff) | |
download | rails-f2ab8b64d4d46d7199f94c3e21021f414a4d259a.tar.gz rails-f2ab8b64d4d46d7199f94c3e21021f414a4d259a.tar.bz2 rails-f2ab8b64d4d46d7199f94c3e21021f414a4d259a.zip |
Merge pull request #34538 from bogdan/reuse-find-target
Reuse code in AR::Association#find_target
Diffstat (limited to 'activerecord/lib/active_record/associations/collection_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 48bb9ab066..f67e62af04 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -304,22 +304,6 @@ module ActiveRecord private - def find_target - scope = self.scope - return scope.to_a if skip_statement_cache?(scope) - - conn = klass.connection - sc = reflection.association_scope_cache(conn, owner) do |params| - as = AssociationScope.create { params.bind } - target_scope.merge!(as.scope(self)) - end - - binds = AssociationScope.get_bind_values(owner, reflection.chain) - sc.execute(binds, conn) do |record| - set_inverse_instance(record) - end - end - # We have some records loaded from the database (persisted) and some that are # in-memory (memory). The same record may be represented in the persisted array # and in the memory array. |