summaryrefslogtreecommitdiff
path: root/lib/api/projects.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-05-06 16:24:58 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-05-06 16:24:58 +0300
commit4528fa9817f2f9ba9ccf330ea2c9f6575b6a3c4b (patch)
tree72990f6527ed987bc99453f8edd0712c7b193c4e /lib/api/projects.rb
parent1882baa1aaa1c195cce55678b2b8a12e1b59db34 (diff)
downloadgitlab-ce-4528fa9817f2f9ba9ccf330ea2c9f6575b6a3c4b.tar.gz
modify api to work with new deploy keys
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r--lib/api/projects.rb7
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