Class: JSONAPI::ErrorSerializer
- Inherits:
-
Object
- Object
- JSONAPI::ErrorSerializer
- Includes:
- Serializer
- Defined in:
- lib/jsonapi/error_serializer.rb
Overview
A simple error serializer
Direct Known Subclasses
Class Method Summary collapse
-
.id_from_record(_record, _params) ⇒ NilClass
Overwrite the ID extraction method, to skip validations.
Instance Method Summary collapse
-
#serializable_hash ⇒ Hash
Remap the root key to ‘errors`.
Class Method Details
.id_from_record(_record, _params) ⇒ NilClass
Overwrite the ID extraction method, to skip validations
20 21 |
# File 'lib/jsonapi/error_serializer.rb', line 20 def self.id_from_record(_record, _params) end |
Instance Method Details
#serializable_hash ⇒ Hash
Remap the root key to ‘errors`
26 27 28 |
# File 'lib/jsonapi/error_serializer.rb', line 26 def serializable_hash { errors: (super[:data] || []).map { |error| error[:attributes] } } end |