From 8e2983dd70e4f13e304dc3dccbad0960f18879a1 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 3 Jun 2017 08:30:32 +0000 Subject: [PATCH] Don't check that param is a Hash. git-svn-id: http://svn.redmine.org/redmine/trunk@16601 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/attachments_controller.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 1c79ff4b3..8f3fcd82e 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -114,11 +114,9 @@ class AttachmentsController < ApplicationController # Update all the attachments of a container def update_all - if params[:attachments].is_a?(Hash) - if Attachment.update_attachments(@attachments, params[:attachments]) - redirect_back_or_default home_path - return - end + if Attachment.update_attachments(@attachments, update_all_params) + redirect_back_or_default home_path + return end render :action => 'edit_all' end @@ -225,4 +223,9 @@ class AttachmentsController < ApplicationController 'attachment' end end + + # Returns attachments param for #update_all + def update_all_params + params.permit(:attachments => [:filename, :description]).require(:attachments) + end end