Sha256: 0ffd719dae9736d4bf83971a51687002a629b7e114b55019c5a6e8473b397902

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true
# encoding: utf-8

class HomCollege
  include Mongoid::Document

  has_one :accreditation, class_name: 'HomAccreditation'

  # The address is added with different dependency mechanisms in tests:
  #has_one :address, class_name: 'HomAddress', dependent: :destroy

  field :state, type: String
end

class HomAccreditation
  include Mongoid::Document

  belongs_to :college, class_name: 'HomCollege'

  field :degree, type: String
  field :year, type: Integer, default: 2012
end

class HomAccreditation::Child
  include Mongoid::Document

  belongs_to :hom_college
end

class HomAddress
  include Mongoid::Document

  belongs_to :college, class_name: 'HomCollege'
end

module HomNs
  class PrefixedParent
    include Mongoid::Document

    has_one :child, class_name: 'PrefixedChild'
  end

  class PrefixedChild
    include Mongoid::Document

    belongs_to :parent, class_name: 'PrefixedParent'
  end
end

class HomPolymorphicParent
  include Mongoid::Document

  has_one :p_child, as: :parent
end

class HomPolymorphicChild
  include Mongoid::Document

  belongs_to :p_parent, polymorphic: true
end

class HomBus
  include Mongoid::Document

  has_one :driver, class_name: 'HomBusDriver'
end

class HomBusDriver
  include Mongoid::Document

  # No belongs_to :bus
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mongoid-7.2.6 spec/mongoid/association/referenced/has_one_models.rb
mongoid-7.2.5 spec/mongoid/association/referenced/has_one_models.rb
mongoid-7.2.4 spec/mongoid/association/referenced/has_one_models.rb
mongoid-7.2.3 spec/mongoid/association/referenced/has_one_models.rb
mongoid-7.2.2 spec/mongoid/association/referenced/has_one_models.rb
mongoid-7.2.1 spec/mongoid/association/referenced/has_one_models.rb
mongoid-7.2.0 spec/mongoid/association/referenced/has_one_models.rb