Exception: Mongoid::Errors::InvalidDependentStrategy

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

Overview

This error is raised when an invalid strategy is defined for an association dependency.

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(association, invalid_strategy, valid_strategies) ⇒ InvalidDependentStrategy

Create the new error.

Examples:

Create the new error.

InvalidDependentStrategy.new(association, invalid_strategy, valid_strategies)

Parameters:

  • association (Mongoid::Association)

    The association for which this dependency is defined.

  • invalid_strategy (Symbol, String)

    The attempted invalid strategy.

  • valid_strategies (Array<Symbol>)

    The valid strategies.

Since:

  • 7.0.0



21
22
23
24
25
26
27
28
29
30
31
# File 'build/mongoid-7.3/lib/mongoid/errors/invalid_dependent_strategy.rb', line 21

def initialize(association, invalid_strategy, valid_strategies)
  super(
      compose_message(
          "invalid_dependent_strategy",
          { association: association,
            invalid_strategy: invalid_strategy,
            valid_strategies: valid_strategies
          }
      )
  )
end