Class: Iry::StatementInvalid
- Inherits:
-
ActiveRecord::StatementInvalid
- Object
- ActiveRecord::StatementInvalid
- Iry::StatementInvalid
- Includes:
- Error
- Defined in:
- lib/iry.rb
Overview
Raised when constraints errors happen and go through Iry, even if these are not handled. This class inherits from ActiveRecord::StatementInvalid to maximize compatibility with existing code
Instance Attribute Summary collapse
-
#error ⇒ ActiveModel::Error
readonly
Error attached to the ‘record` for the constraint violation.
-
#record ⇒ Handlers::Model
readonly
Model affected by the constraint violation.
Instance Method Summary collapse
-
#initialize(message = nil, record:, error:, **kwargs) ⇒ StatementInvalid
constructor
A new instance of StatementInvalid.
Constructor Details
#initialize(message = nil, record:, error:, **kwargs) ⇒ StatementInvalid
Returns a new instance of StatementInvalid.
71 72 73 74 75 |
# File 'lib/iry.rb', line 71 def initialize( = nil, record:, error:, **kwargs) @record = record @error = error super(, **kwargs) end |
Instance Attribute Details
#error ⇒ ActiveModel::Error (readonly)
Returns error attached to the ‘record` for the constraint violation.
66 67 68 |
# File 'lib/iry.rb', line 66 def error @error end |
#record ⇒ Handlers::Model (readonly)
Returns model affected by the constraint violation.
63 64 65 |
# File 'lib/iry.rb', line 63 def record @record end |