Flowdock
method

load_records

Importance_0
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: Association
load_records() private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations/preloader/association.rb, line 41
          def load_records
            # owners can be duplicated when a relation has a collection association join
            # #compare_by_identity makes such owners different hash keys
            @records_by_owner = {}.compare_by_identity
            raw_records = owner_keys.empty? ? [] : records_for(owner_keys)

            @preloaded_records = raw_records.select do |record|
              assignments = false

              owners_by_key[convert_key(record[association_key_name])].each do |owner|
                entries = (@records_by_owner[owner] ||= [])

                if reflection.collection? || entries.empty?
                  entries << record
                  assignments = true
                end
              end

              assignments
            end
          end
Register or log in to add new notes.