1
0
Fork 0

Move action PublicKeysController#show to AsymmetricKeysController#show

This commit is contained in:
Alex Kotov 2019-09-15 04:03:50 +05:00
parent 454bd596ef
commit be9156a5da
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 7 additions and 30 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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