Exception: Mongoid::Errors::InvalidOptions

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

Overview

Raised when invalid options are passed to an association macro.

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(name, invalid, valid) ⇒ InvalidOptions

Instantiate the options error.

Examples:

Create the error.

InvalidOptions.new(:name, :polymorphic, [ :as ])

Parameters:

  • name (Symbol)

    The name of the association.

  • invalid (Symbol)

    The invalid option.

  • valid (Array<Symbol>)

    The allowed options.

Since:

  • 2.1.0



20
21
22
23
24
25
26
27
# File 'build/mongoid-7.3/lib/mongoid/errors/invalid_options.rb', line 20

def initialize(name, invalid, valid)
  super(
    compose_message(
      "invalid_options",
      { name: name, invalid: invalid, valid: valid.join(', ') }
    )
  )
end