Sha256: 673dcc5736740e23cd735fd7ae74600a04244ab9b351d3a775149699640c799b

Contents?: true

Size: 688 Bytes

Versions: 4

Compression:

Stored size: 688 Bytes

Contents

class Article
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::EmbeddedErrors

  field :name, type: String
  field :summary, type: String

  validates :name, presence: true
  validates :summary, presence: true

  embeds_many :pages
end

class Page
  include Mongoid::Document
  include Mongoid::Timestamps

  field :title, type: String

  validates :title, presence: true

  embedded_in :article, inverse_of: :pages
  embeds_many :sections
end

class Section
  include Mongoid::Document
  include Mongoid::Timestamps

  field :header, type: String
  field :body, type: String

  validates :header, presence: true

  embedded_in :page, inverse_of: :sections
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-embedded-errors-2.0.0 spec/support/models.rb
mongoid-embedded-errors-1.1.0 spec/support/models.rb
mongoid-embedded-errors-1.0.1 spec/support/models.rb
mongoid-embedded-errors-1.0.0 spec/support/models.rb