class Pragma::Operation::Destroy

Finds an existing record, destroys it and responds 204 No Content.

@author Alessandro Desantis

Public Instance Methods

destroy!(_options, model:, **) click to toggle source
# File lib/pragma/operation/destroy.rb, line 15
def destroy!(_options, model:, **)
  unless model.destroy
    options['result.response'] = Response::UnprocessableEntity.new(
      errors: model.errors
    ).decorate_with(Decorator::Error)

    return false
  end

  true
end
respond!(options) click to toggle source
# File lib/pragma/operation/destroy.rb, line 27
def respond!(options)
  options['result.response'] = Response::NoContent.new
end