Sha256: 54377f785253604f97774d3e6a982cdfd7af4cc3f429c2af2f2877fc39f54711

Contents?: true

Size: 485 Bytes

Versions: 53

Compression:

Stored size: 485 Bytes

Contents

# encoding: utf-8
module Mongoid
  module Relations
    module Eager

      class HasOne < Base

        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
          @metadata.primary_key
        end

        def key
          @metadata.foreign_key
        end

      end
    end
  end
end

Version data entries

53 entries across 48 versions & 3 rubygems

Version Path
mongoid-6.4.8 lib/mongoid/relations/eager/has_one.rb
mongoid-6.4.7 lib/mongoid/relations/eager/has_one.rb
mongoid-6.4.5 lib/mongoid/relations/eager/has_one.rb
mongoid-5.4.1 lib/mongoid/relations/eager/has_one.rb
mongoid-6.4.4 lib/mongoid/relations/eager/has_one.rb
mongoid-6.4.2 lib/mongoid/relations/eager/has_one.rb
mongoid-6.4.1 lib/mongoid/relations/eager/has_one.rb
mongoid-5.4.0 lib/mongoid/relations/eager/has_one.rb
tdiary-5.0.8 vendor/bundle/gems/mongoid-6.4.0/lib/mongoid/relations/eager/has_one.rb
mongoid-6.4.0 lib/mongoid/relations/eager/has_one.rb
mongoid-6.3.0 lib/mongoid/relations/eager/has_one.rb
mongoid-6.2.1 lib/mongoid/relations/eager/has_one.rb
tdiary-5.0.5 vendor/bundle/gems/mongoid-6.2.0/lib/mongoid/relations/eager/has_one.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/mongoid-6.1.0/lib/mongoid/relations/eager/has_one.rb
tdiary-5.0.5 vendor/bundle/gems/mongoid-6.1.0/lib/mongoid/relations/eager/has_one.rb
mongoid-6.2.0 lib/mongoid/relations/eager/has_one.rb
mongoid-6.1.1 lib/mongoid/relations/eager/has_one.rb
mongoid-5.2.1 lib/mongoid/relations/eager/has_one.rb
tdiary-5.0.4 vendor/bundle/gems/mongoid-6.1.0/lib/mongoid/relations/eager/has_one.rb
mongoid-6.1.0 lib/mongoid/relations/eager/has_one.rb