Exception: Mongoid::Errors::InvalidOptions

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



18
19
20
21
22
23
24
25
# File 'lib/mongoid/errors/invalid_options.rb', line 18

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