Sha256: 89e78d40f7620455363a2c2a59be6fd34e659872fae2986327ea9361bf6b5919

Contents?: true

Size: 627 Bytes

Versions: 3

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

class EmmCongress
  include Mongoid::Document

  embeds_many :legislators, class_name: 'EmmLegislator'

  field :name, type: String
end

class EmmLegislator
  include Mongoid::Document

  embedded_in :congress, class_name: 'EmmCongress'

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

class EmmManufactory
  include Mongoid::Document

  embeds_many :products, order: :id.desc, class_name: 'EmmProduct'
end


class EmmProduct
  include Mongoid::Document

  embedded_in :manufactory, class_name: 'EmmManufactory'

  field :name, type: String
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid-7.1.1 spec/mongoid/association/embedded/embeds_many_models.rb
mongoid-7.1.0 spec/mongoid/association/embedded/embeds_many_models.rb
mongoid-7.1.0.rc0 spec/mongoid/association/embedded/embeds_many_models.rb