Exception: Mongoid::Errors::InverseNotFound

Inherits:
MongoidError
  • Object
show all
Defined in:
lib/mongoid/errors/inverse_not_found.rb

Overview

Raised when no inverse_of definition can be found when needed.

Constant Summary

Constants inherited from MongoidError

MongoidError::BASE_KEY

Instance Method Summary collapse

Methods inherited from MongoidError

#compose_message

Constructor Details

#initialize(base, name, klass, inverse) ⇒ InverseNotFound

Create then new error.

Examples:

Create the new error.

InverseNotFound.new(Town, :citizens, Person, :town_id)

Parameters:

  • base (Class)

    The base class.

  • name (Symbol)

    The name of the relation.

  • The (Class)

    child class.

  • inverse (Symbol)

    The attempted inverse key.

Since:

  • 3.0.0



19
20
21
22
23
24
25
26
# File 'lib/mongoid/errors/inverse_not_found.rb', line 19

def initialize(base, name, klass, inverse)
  super(
    compose_message(
      "inverse_not_found",
      { base: base, name: name, klass: klass, inverse: inverse }
    )
  )
end