From b774cb9b1176510b84b9c488a61fbcd0d74f56bd Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 29 Apr 2019 00:31:36 +0300 Subject: [PATCH] Add params filtering in Management::EventsController#index --- app/controllers/management/events_controller.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/management/events_controller.rb b/app/controllers/management/events_controller.rb index d0e4ea1..a41b47c 100644 --- a/app/controllers/management/events_controller.rb +++ b/app/controllers/management/events_controller.rb @@ -2,7 +2,7 @@ module Management class EventsController < ManagementController def index @conference = find_conference - @filters = params[:filters] || {} + @filters = filter_params || {} @events = EventSearch.new(scope: Event.where(conference: @conference).eager_load(:participants_with_personal_profiles, :proposition, :proposer, :track, :event_type).preload(:conference), filters: params[:filters]).results # @events = @conference.events.order(:title).includes(:proposition, :proposer, :track, :event_type) end @@ -49,6 +49,17 @@ module Management Conference.find(params[:conference_id]) end + def filter_params + params.fetch(:filters, {}).permit( + :event_type_id, + :track_id, + :language, + :status, + :confirmed, + :not_confirmed, + ) + end + def event_params params.require(:event).permit( :title,