summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-09-21 10:55:24 +0200
committerJames Lopez <james@jameslopez.es>2017-09-28 08:46:39 +0200
commitcbb90d8f84d1f79560066d8ea3c6346906e7da94 (patch)
tree368542aafe8b5e0a74772122c7967dcae6cabc8a
parent4a6ec7c947b8ae5360b220ec8c6c91b2221d2091 (diff)
downloadgitlab-ce-cbb90d8f84d1f79560066d8ea3c6346906e7da94.tar.gz
refactor keys controller
-rw-r--r--app/controllers/profiles/keys_controller.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb
index 89d6d7f1b52..069e6a810f2 100644
--- a/app/controllers/profiles/keys_controller.rb
+++ b/app/controllers/profiles/keys_controller.rb
@@ -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