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 a relation macro.

Constant Summary

Constant Summary

Constants inherited from MongoidError

MongoidError::BASE_KEY

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 relation.

  • invalid (Symbol)

    The invalid option.

  • valid (Array<Symbol>)

    The allowed options.

Since:

  • 2.1.0



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