Sha256: a494a5f946c9f65361ab3e9d7861b2a2fbd9c0b8f3e4979e6f22dbbbde4a8783

Contents?: true

Size: 625 Bytes

Versions: 25

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

module Mongoid
  module Association
    module Referenced

      class HasOne

        class Eager < Association::Referenced::Eager::Base

          private

          def preload
            @docs.each do |d|
              set_relation(d, nil)
            end

            each_loaded_document do |doc|
              id = doc.send(key)
              set_on_parent(id, doc)
            end
          end

          def group_by_key
            @association.primary_key
          end

          def key
            @association.foreign_key
          end

        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
mongoid-8.1.8 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.1.7 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.1.6 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.0.8 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.1.5 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.1.4 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.0.7 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.1.3 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.1.2 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.0.6 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-7.5.4 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.1.1 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.0.5 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.1.0 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-7.5.3 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.0.4 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.0.3 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-7.5.2 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-8.0.2 lib/mongoid/association/referenced/has_one/eager.rb
mongoid-7.5.1 lib/mongoid/association/referenced/has_one/eager.rb