Exception: UseCasePattern::ValidationError
- Inherits:
-
StandardError
- Object
- StandardError
- UseCasePattern::ValidationError
- Defined in:
- lib/use_case_pattern/base.rb
Overview
Use Case Pattern ValidationError
Raised by perform! when validations result in errors.
Check the use case errors object for attribute error messages.
ActiveModel 5.0 has an ActiveModel::ValidationError class, prior versions including 4.2 do not.
This class may be deprecated by ActiveModel::ValidationError in the future.
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model) ⇒ ValidationError
constructor
A new instance of ValidationError.
Constructor Details
#initialize(model) ⇒ ValidationError
Returns a new instance of ValidationError.
62 63 64 65 66 |
# File 'lib/use_case_pattern/base.rb', line 62 def initialize(model) @model = model errors = @model.errors..join(", ") super("Validation failed: " + errors) end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
60 61 62 |
# File 'lib/use_case_pattern/base.rb', line 60 def model @model end |