Exception: Mongoid::Errors::InvalidIncludes

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

Overview

This error is raised when an invalid value is passed to an eager loading query.

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, args) ⇒ InvalidIncludes

Initialize the error.

Examples:

Initialize the error.

InvalidIncludes.new(Band, [ :members ])

Parameters:

  • klass (Class)

    The model class.

  • args (Array<Object>)

    The arguments passed to the includes.

Since:

  • 3.0.2



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

def initialize(klass, args)
  super(
    compose_message(
      "invalid_includes",
      {
        klass: klass.name,
        args: args.map(&:inspect).join(", "),
        relations: klass.relations.keys.map(&:inspect).join(", ")
      }
    )
  )
end