Class: Pragma::Operation::Destroy
- Inherits:
-
Base
- Object
- Base
- Pragma::Operation::Destroy
- Defined in:
- lib/pragma/operation/destroy.rb
Overview
Finds an existing record, destroys it and responds 204 No Content.
Instance Method Summary collapse
Instance Method Details
#destroy!(_options, model:) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pragma/operation/destroy.rb', line 15 def destroy!(, model:, **) unless model.destroy ['result.response'] = Response::UnprocessableEntity.new( errors: model.errors ).decorate_with(Decorator::Error) return false end true end |
#respond!(options) ⇒ Object
27 28 29 |
# File 'lib/pragma/operation/destroy.rb', line 27 def respond!() ['result.response'] = Response::NoContent.new end |