Sha256: 57663db04658e7159a5a03df57b1bce918288a6a761b4005943a359e895a9089

Contents?: true

Size: 1.23 KB

Versions: 14

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true
# encoding: utf-8

class EomParent
  include Mongoid::Document
  include Mongoid::Timestamps

  embeds_one :child, class_name: 'EomChild'

  field :name, type: String
end

class EomChild
  include Mongoid::Document

  embedded_in :parent, class_name: 'EomParent'

  field :a, type: Integer, default: 0
  field :b, type: Integer, default: 0
end

# Models with associations with :class_name as a :: prefixed string

class EomCcParent
  include Mongoid::Document

  embeds_one :child, class_name: '::EomCcChild'
end

class EomCcChild
  include Mongoid::Document

  embedded_in :parent, class_name: '::EomCcParent'
end

# Models referencing other models which should not be loaded unless the
# respective association is referenced

autoload :EomDnlMissingChild, 'mongoid/association/embedded/embeds_one_dnl_models'

class EomDnlParent
  include Mongoid::Document

  embeds_one :child, class_name: 'EomDnlChild'
  embeds_one :missing_child, class_name: 'EomDnlMissingChild'
end

autoload :EomDnlMissingParent, 'mongoid/association/embedded/embeds_one_dnl_models'

class EomDnlChild
  include Mongoid::Document

  embedded_in :parent, class_name: 'EomDnlParent'
  embedded_in :missing_parent, class_name: 'EomDnlMissingParent'
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mongoid-7.3.5 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.3.4 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.2.6 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.3.3 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.3.2 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.2.5 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.2.4 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.3.1 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.3.0 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.2.3 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.2.2 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.2.1 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.2.0 spec/mongoid/association/embedded/embeds_one_models.rb
mongoid-7.2.0.rc1 spec/mongoid/association/embedded/embeds_one_models.rb