Sha256: 917972426dfa333b70870463fc63e05e9bb17ca8b54b180ab1667bf423194f95
Contents?: true
Size: 784 Bytes
Versions: 2
Compression:
Stored size: 784 Bytes
Contents
# frozen_string_literal: true # encoding: utf-8 module Mongoid module Association module Referenced class BelongsTo # Eager class for belongs_to associations. class Eager < Association::Referenced::Eager::Base private def preload raise Errors::EagerLoad.new(@association.name) if @association.polymorphic? @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.foreign_key end def key @association.primary_key end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongoid-7.1.0 | lib/mongoid/association/referenced/belongs_to/eager.rb |
mongoid-7.1.0.rc0 | lib/mongoid/association/referenced/belongs_to/eager.rb |