You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: key_pairs_controller.rb
    path of file: ./repos/foreman/app/controllers
    
    the code of the file until where you have to start completion: class KeyPairs
    
  def destroy
    key_to_delete = params[:id]
    return not_found unless key_to_delete
    if @compute_resource.delete_key_from_resource(key_to_delete)
      process_success :success_msg => _('Successfully delete %s') % key_to_delete,
                      :success_redirect => compute_resource_path(@compute_resource)
    else
      process_error :error_msg => _('Could not delete %s') % key_to_delete
    end