From e6f79e0a9c151884705ae80d11fa042cb7820dc7 Mon Sep 17 00:00:00 2001
From: Marcela Ribeiro de Oliveira <mro15@inf.ufpr.br>
Date: Tue, 18 Oct 2016 09:45:17 -0200
Subject: [PATCH] fix add_object to collection method

---
 app/controllers/v1/collections_controller.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/controllers/v1/collections_controller.rb b/app/controllers/v1/collections_controller.rb
index f7d1aad67..b0b84494e 100644
--- a/app/controllers/v1/collections_controller.rb
+++ b/app/controllers/v1/collections_controller.rb
@@ -56,7 +56,7 @@ class V1::CollectionsController < ApplicationController
   def add_object
     render nothing: true, status: :unprocessable_entity if params.nil?
 
-    items = params[:items]
+    items = collection_params[:items]
 
     items.each do |item|
       order = item[:order]
@@ -87,7 +87,7 @@ class V1::CollectionsController < ApplicationController
 
   # Never trust parameters from the scary internet, only allow the white list through.
   def collection_params
-    params.require(:collection).permit(:name, :description, :owner_id, :owner_type, :privacy, tags: [], items: [])
+    params.require(:collection).permit(:name, :description, :owner_id, :owner_type, :privacy, tags: [], items: [:type, :id])
   end
 
 end
-- 
GitLab