Exception: Caprese::RecordInvalidError
- Defined in:
- lib/caprese/errors.rb
Overview
Thrown when a record was attempted to be persisted and was invalidated
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Attributes inherited from Error
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(record, engaged_field_aliases = {}) ⇒ RecordInvalidError
constructor
A new instance of RecordInvalidError.
Methods inherited from Error
#full_message, #i18n_scope, #with_header
Constructor Details
#initialize(record, engaged_field_aliases = {}) ⇒ RecordInvalidError
Returns a new instance of RecordInvalidError.
25 26 27 28 29 30 |
# File 'lib/caprese/errors.rb', line 25 def initialize(record, engaged_field_aliases = {}) super() @record = record @aliases = engaged_field_aliases @header = { status: :unprocessable_entity } end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
23 24 25 |
# File 'lib/caprese/errors.rb', line 23 def aliases @aliases end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
23 24 25 |
# File 'lib/caprese/errors.rb', line 23 def record @record end |
Instance Method Details
#as_json ⇒ Object
32 33 34 |
# File 'lib/caprese/errors.rb', line 32 def as_json record.errors.as_json end |