Sha256: e12d24e30b1aa5321f6e0652fb58473b35360dd13dc51bef6fbca4532a04d780

Contents?: true

Size: 497 Bytes

Versions: 1

Compression:

Stored size: 497 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module Associations
    class Preloader
      class SingularAssociation < Association #:nodoc:
        private

          def preload(preloader)
            associated_records_by_owner(preloader).each do |owner, associated_records|
              record = associated_records.first

              association = owner.association(reflection.name)
              association.target = record
            end
          end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-on-quails-0.1.0 activerecord/lib/active_record/associations/preloader/singular_association.rb