From f724e588005419865aefb06ee0b16f47d5d5c050 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 16 Jun 2019 10:30:08 +0300 Subject: [PATCH] Fix exception when trying to filter by volunteer team --- app/controllers/management/volunteers_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/management/volunteers_controller.rb b/app/controllers/management/volunteers_controller.rb index 0ce4278..eb49a8b 100644 --- a/app/controllers/management/volunteers_controller.rb +++ b/app/controllers/management/volunteers_controller.rb @@ -3,7 +3,7 @@ module Management include CurrentConferenceAssigning def index - @filters = params[:filters] || {} + @filters = filter_params || {} @volunteers = VolunteerSearch.new(scope: Volunteer.where(conference: current_conference).eager_load(:volunteer_teams), filters: params[:filters]).results end @@ -27,6 +27,10 @@ module Management private + def filter_params + params.fetch(:filters, {}).permit(:volunteer_team_id) + end + def volunteer_params params.require(:volunteer).permit(:name, :picture, :email, :phone, :tshirt_size, :tshirt_cut,