Exception: Mongoid::Errors::InvalidRelation

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

Overview

This error is raised when trying to create an association that conflicts with an already defined method.

Since:

  • 6.0.0

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, name) ⇒ InvalidRelation

Create the new error.

Examples:

Create the error.

InvalidRelation.new(person, :crazy_relation_name)

Parameters:

  • klass (Class)

    The document class.

  • name (Symbol)

    The method name.

Since:

  • 6.0.0



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'build/mongoid-master/lib/mongoid/errors/invalid_relation.rb', line 20

def initialize(klass, name)
  super(
      compose_message(
          "invalid_relation",
          {
              name: name,
              origin: origin(klass, name),
              file: location(klass, name)[0],
              line: location(klass, name)[1]
          }
      )
  )
end