aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/preloader/singular_association.rb
blob: 30a92411e32b957f8e59ea6f4fd9faead04e6afc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

module ActiveRecord
  module Associations
    class Preloader
      class SingularAssociation < Association #:nodoc:
        private
          def associate_records_to_owner(owner, records)
            association = owner.association(reflection.name)
            association.target = records.first
          end
      end
    end
  end
end