method

grouped_records

rails latest stable - Class: ActiveRecord::Associations::Preloader::Branch
grouped_records()
public

No documentation available.

# File activerecord/lib/active_record/associations/preloader/branch.rb, line 74
        def grouped_records
          h = {}
          polymorphic_parent = !root? && parent.polymorphic?
          source_records.each do |record|
            reflection = record.class._reflect_on_association(association)
            next if polymorphic_parent && !reflection || !record.association(association).klass
            (h[reflection] ||= []) << record
          end
          h
        end