method

load_records

Importance_0
v5.0.0.1 - Show latest stable - 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 102
        def load_records
          return {} if owner_keys.empty?
          # Some databases impose a limit on the number of ids in a list (in Oracle it's 1000)
          # Make several smaller queries if necessary or make one query if the adapter supports it
          slices  = owner_keys.each_slice(klass.connection.in_clause_length || owner_keys.size)
          @preloaded_records = slices.flat_map do |slice|
            records_for(slice)
          end
          @preloaded_records.group_by do |record| 
            convert_key(record[association_key_name])
          end
        end
Register or log in to add new notes.