diff options
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 75157e55730..53fd91dcca8 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -531,8 +531,8 @@ module Gitlab # POST /projects/:id/keys post ":id/keys" do attrs = attributes_for_keys [:title, :key] - key = user_project.deploy_keys.new attrs - if key.save + key = DeployKey.new attrs + if key.valid? && user_project.deploy_keys << key present key, with: Entities::SSHKey else not_found! @@ -545,9 +545,8 @@ module Gitlab # DELETE /projects/:id/keys/:id delete ":id/keys/:key_id" do key = user_project.deploy_keys.find params[:key_id] - key.delete + key.destroy end - end end end |