Move action PublicKeysController#show to AsymmetricKeysController#show
This commit is contained in:
parent
454bd596ef
commit
be9156a5da
4 changed files with 7 additions and 30 deletions
|
@ -12,6 +12,13 @@ class AsymmetricKeysController < ApplicationController
|
||||||
# GET /asymmetric_keys/:id
|
# GET /asymmetric_keys/:id
|
||||||
def show
|
def show
|
||||||
authorize @asymmetric_key
|
authorize @asymmetric_key
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.pem do
|
||||||
|
send_data @asymmetric_key.public_key_pem, filename: 'public.pem'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class PublicKeysController < ApplicationController
|
|
||||||
before_action :set_asymmetric_key
|
|
||||||
|
|
||||||
# GET /asymmetric_keys/:asymmetric_key_id/public_key
|
|
||||||
def show
|
|
||||||
authorize @asymmetric_key
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.pem do
|
|
||||||
send_data @asymmetric_key.public_key_pem, filename: 'public.pem'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_asymmetric_key
|
|
||||||
@asymmetric_key = AsymmetricKey.find params[:asymmetric_key_id]
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -14,7 +14,6 @@ Rails.application.routes.draw do
|
||||||
resources :federal_subjects, param: :number, only: %i[index show]
|
resources :federal_subjects, param: :number, only: %i[index show]
|
||||||
|
|
||||||
resources :asymmetric_keys, only: %i[index show] do
|
resources :asymmetric_keys, only: %i[index show] do
|
||||||
resource :public_key, only: :show
|
|
||||||
resource :private_key, only: :show
|
resource :private_key, only: :show
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe 'GET /public_keys/:id' do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
Reference in a new issue