Exception: Mongoid::Errors::InvalidIncludes

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



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mongoid/errors/invalid_includes.rb', line 18

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