Exception: Mongoid::Errors::NoParent

Inherits:
MongoidError
  • Object
show all
Defined in:
build/mongoid-7.3/lib/mongoid/errors/no_parent.rb

Overview

This error is raised when trying to persist an embedded document when there is no parent set.

Constant Summary

Constants inherited from MongoidError

MongoidError::BASE_KEY

Instance Attribute Summary

Attributes inherited from MongoidError

#problem, #resolution, #summary

Instance Method Summary collapse

Methods inherited from MongoidError

#compose_message

Constructor Details

#initialize(klass) ⇒ NoParent

Create the new error.

Examples:

Create the new error.

NoParent.new(klass)

Parameters:

  • klass (Class)

    The class of the embedded document.

Since:

  • 3.0.0



19
20
21
22
23
# File 'build/mongoid-7.3/lib/mongoid/errors/no_parent.rb', line 19

def initialize(klass)
  super(
    compose_message("no_parent", { klass: klass })
  )
end