Class: RecordNotFoundSerializer
- Inherits:
-
Object
- Object
- RecordNotFoundSerializer
- Defined in:
- lib/serializers/record_not_found_serializer.rb
Instance Method Summary collapse
-
#initialize(error) ⇒ RecordNotFoundSerializer
constructor
A new instance of RecordNotFoundSerializer.
- #serialize ⇒ Object
Constructor Details
#initialize(error) ⇒ RecordNotFoundSerializer
Returns a new instance of RecordNotFoundSerializer.
4 5 6 7 |
# File 'lib/serializers/record_not_found_serializer.rb', line 4 def initialize(error) @error = error @resource = error.model.underscore end |
Instance Method Details
#serialize ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/serializers/record_not_found_serializer.rb', line 9 def serialize { success: false, errors: [ { resource: resource, field: nil }.merge(details) ] } end |