class Mongoid::Includes::Errors::InvalidIncludes

Public: This error is raised when an invalid include is performed.

Public Class Methods

new(klass, args, options) click to toggle source

Public: Composes a message from the class the includes would be performed on, the relations to be included, and the options.

Calls superclass method
# File lib/mongoid/includes/errors/invalid_includes.rb, line 10
def initialize(klass, args, options)
  super compose_message(type, options.merge(
    klass: klass, relations: klass.relations.keys, args: Array.wrap(args)
  ))
end

Public Instance Methods

compose_message(type, options) click to toggle source

Overrides: Helps to keep the templates simple by using inspect on the options.

Calls superclass method
# File lib/mongoid/includes/errors/invalid_includes.rb, line 22
def compose_message(type, options)
  super type, options.transform_values { |value|
    value.is_a?(Array) ? value.map(&:inspect).join(', ') : value.inspect
  }
end
type() click to toggle source

Internal: Key of the translation message

# File lib/mongoid/includes/errors/invalid_includes.rb, line 17
def type
  :invalid_includes
end