Exception: Pragma::Decorator::Association::InconsistentTypeError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pragma/decorator/association/errors.rb

Overview

This error is raised when an association’s type is different from its type as reported by the model’s reflection.

Author:

  • Alessandro Desantis

Instance Method Summary collapse

Constructor Details

#initialize(decorator:, reflection:, model_type:) ⇒ InconsistentTypeError

Initializes the error.

Parameters:

  • decorator (Base)

    the decorator where the association is defined

  • reflection (Reflection)

    the reflection of the inconsistent association

  • model_type (Symbol|String)

    the real type of the association



56
57
58
59
60
61
62
63
# File 'lib/pragma/decorator/association/errors.rb', line 56

def initialize(decorator:, reflection:, model_type:)
  message = <<~MSG.tr("\n", ' ')
    #{decorator.class}: Association #{reflection.attribute} is defined as #{model_type} on
    the model, but as #{reflection.type} in the decorator.
  MSG

  super message
end