Exception: Mongoid::Errors::InvalidDependentStrategy

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



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

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