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 Attribute Summary

Attributes inherited from MongoidError

#problem, #resolution, #summary

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 association.

  • klass (Class)

    The child class.

  • inverse (Symbol)

    The attempted inverse key.



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