Sha256: 55d8ed3f9d791a1484b555ffff0612e553392f023dd38af6d036d2ea88268b1a

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true
# encoding: utf-8

class HmmCompany
  include Mongoid::Document

  field :p, type: Integer
  has_many :emails, primary_key: :p, foreign_key: :f, class_name: 'HmmEmail'

  # The addresses are added with different dependency mechanisms in tests:
  #has_many :addresses, class_name: 'HmmAddress', dependent: :destroy
end

class HmmEmail
  include Mongoid::Document

  field :f, type: Integer
  belongs_to :company, primary_key: :p, foreign_key: :f, class_name: 'HmmCompany'
end

class HmmAddress
  include Mongoid::Document

  belongs_to :company, class_name: 'HmmCompany'
end

class HmmSchool
  include Mongoid::Document

  has_many :students, class_name: 'HmmStudent'

  field :district, type: String
  field :team, type: String
end

class HmmStudent
  include Mongoid::Document

  belongs_to :school, class_name: 'HmmSchool'

  field :name, type: String
  field :grade, type: Integer, default: 3
end

class HmmTicket
  include Mongoid::Document

  belongs_to :person
end

class HmmBus
  include Mongoid::Document

  has_many :seats, class_name: 'HmmBusSeat'
end

class HmmBusSeat
  include Mongoid::Document

  # No belongs_to :bus
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mongoid-7.3.2 spec/mongoid/association/referenced/has_many_models.rb
mongoid-7.2.5 spec/mongoid/association/referenced/has_many_models.rb
mongoid-7.2.4 spec/mongoid/association/referenced/has_many_models.rb
mongoid-7.3.1 spec/mongoid/association/referenced/has_many_models.rb
mongoid-7.3.0 spec/mongoid/association/referenced/has_many_models.rb
mongoid-7.2.3 spec/mongoid/association/referenced/has_many_models.rb
mongoid-7.2.2 spec/mongoid/association/referenced/has_many_models.rb
mongoid-7.2.1 spec/mongoid/association/referenced/has_many_models.rb
mongoid-7.2.0 spec/mongoid/association/referenced/has_many_models.rb