Exception: Mongoid::Errors::NoParent

Inherits:
MongoidError
  • Object
show all
Defined in:
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 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



17
18
19
20
21
# File 'lib/mongoid/errors/no_parent.rb', line 17

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