From 19e6740ee468aee2b2f2f8710173940c9e609529 Mon Sep 17 00:00:00 2001 From: kikito Date: Fri, 4 Sep 2015 11:50:29 +0200 Subject: [PATCH] Refactors has_filters.rb --- app/controllers/concerns/has_filters.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/concerns/has_filters.rb b/app/controllers/concerns/has_filters.rb index eeca1745f..ea5397183 100644 --- a/app/controllers/concerns/has_filters.rb +++ b/app/controllers/concerns/has_filters.rb @@ -5,8 +5,7 @@ module HasFilters def has_filters(valid_filters, *args) before_action(*args) do @valid_filters = valid_filters - @current_filter = params[:filter] - @current_filter = @valid_filters.first unless @valid_filters.include?(@current_filter) + @current_filter = @valid_filters.include?(params[:filter]) ? params[:filter] : @valid_filters.first end end end