From 5cc4aa063401616f25cb14c8cddb56d425b6b44a Mon Sep 17 00:00:00 2001 From: Jose Farias Date: Thu, 7 Nov 2024 16:09:12 -0600 Subject: [PATCH] Simplify filter destruction --- app/controllers/filters_controller.rb | 8 ++------ test/controllers/filters_controller_test.rb | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/filters_controller.rb b/app/controllers/filters_controller.rb index ba3c2d94a..34a020c4f 100644 --- a/app/controllers/filters_controller.rb +++ b/app/controllers/filters_controller.rb @@ -1,5 +1,5 @@ class FiltersController < ApplicationController - before_action :set_filter, :remember_params, only: :destroy + before_action :set_filter, only: :destroy def create @filter = Current.user.filters.persist! filter_params @@ -16,10 +16,6 @@ class FiltersController < ApplicationController @filter = Current.user.filters.find params[:id] end - def remember_params - @filter_params = @filter.to_params - end - def filter_params params.permit(*Filter::KNOWN_PARAMS).compact_blank end @@ -28,7 +24,7 @@ class FiltersController < ApplicationController if request.referer == root_url redirect_to root_path else - redirect_to bubbles_path(@filter_params) + redirect_to bubbles_path(@filter.to_params) end end end diff --git a/test/controllers/filters_controller_test.rb b/test/controllers/filters_controller_test.rb index 332b11d5e..7d3c59817 100644 --- a/test/controllers/filters_controller_test.rb +++ b/test/controllers/filters_controller_test.rb @@ -25,10 +25,9 @@ class FiltersControllerTest < ActionDispatch::IntegrationTest end test "destroy" do - params = filters(:jz_assignments).to_params assert_difference "Filter.count", -1 do delete filter_url(filters(:jz_assignments)) end - assert_redirected_to bubbles_path(params) + assert_redirected_to bubbles_path(filters(:jz_assignments).params) end end