OSDN Git Service

Uses attributes_for_keys
authorAlex Denisov <1101.debian@gmail.com>
Sun, 16 Sep 2012 19:44:20 +0000 (22:44 +0300)
committerAlex Denisov <1101.debian@gmail.com>
Sun, 16 Sep 2012 19:44:20 +0000 (22:44 +0300)
lib/api/keys.rb

index d58c7ca..4c30272 100644 (file)
@@ -26,10 +26,8 @@ module Gitlab
       # Example Request:
       #   POST /keys
       post do
-        key = current_user.keys.new(
-          title: params[:title],
-          key: params[:key]
-        )
+        attrs = attributes_for_keys [:title, :key]
+        key = current_user.keys.new attrs
         if key.save
           present key, with: Entities::Key
         else