Sha256: e4c78e1ca6f2b1115266dcf856c1aa7b118f392d62c9eec38acf77c44ea2f118

Contents?: true

Size: 454 Bytes

Versions: 24

Compression:

Stored size: 454 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

24 entries across 24 versions & 3 rubygems

Version Path
activerecord-5.0.7.2 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.7.1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.7 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.6 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.6.rc1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.5 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.5.rc2 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.5.rc1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.4 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.4.rc1 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.3 lib/active_record/associations/preloader/singular_association.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activerecord-5.0.2/lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.2 lib/active_record/associations/preloader/singular_association.rb
activerecord-5.0.2.rc1 lib/active_record/associations/preloader/singular_association.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/associations/preloader/singular_association.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/associations/preloader/singular_association.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/associations/preloader/singular_association.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/associations/preloader/singular_association.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/associations/preloader/singular_association.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/associations/preloader/singular_association.rb