refactor keys controller

This commit is contained in:
James Lopez 2017-09-21 10:55:24 +02:00
parent 4a6ec7c947
commit cbb90d8f84
1 changed files with 7 additions and 1 deletions

View File

@ -14,7 +14,7 @@ class Profiles::KeysController < Profiles::ApplicationController
@key = Keys::CreateService.new(current_user, key_params).execute
if @key.persisted?
redirect_to profile_key_path(@key)
redirect_to_profile_key_path
else
@keys = current_user.keys.select(&:persisted?)
render :index
@ -50,6 +50,12 @@ class Profiles::KeysController < Profiles::ApplicationController
end
end
protected
def redirect_to_profile_key_path
redirect_to profile_key_path(@key)
end
private
def key_params