Sha256: 7ee6cfa994fa17d28ba3ee1b6f5ba5ef72969b084057e0d37c1afff011b38e71

Contents?: true

Size: 466 Bytes

Versions: 20

Compression:

Stored size: 466 Bytes

Contents

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

20 entries across 20 versions & 1 rubygems

Version Path
activerecord-5.1.7 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.7.rc1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.6.2 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.6.1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.6 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.5 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.5.rc1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.4 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.4.rc1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.3 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.3.rc3 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.3.rc2 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.3.rc1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.2 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.2.rc1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.0 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.0.rc2 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.0.rc1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.1.0.beta1 lib/active_record/associations/preloader/singular_association.rb