From 5e09fddbe01e50e6678722ae8b76f030f7966201 Mon Sep 17 00:00:00 2001 From: Jose Farias Date: Fri, 13 Dec 2024 18:49:41 -0600 Subject: [PATCH] Revert "Destroy equivalent filters upon resource removal" This reverts commit 6c69bf7dc12a877384866a30d9d58f35f31ec29c. --- app/models/filter/resources.rb | 2 -- test/models/filter_test.rb | 5 ----- 2 files changed, 7 deletions(-) diff --git a/app/models/filter/resources.rb b/app/models/filter/resources.rb index bde1a30d1..85950f857 100644 --- a/app/models/filter/resources.rb +++ b/app/models/filter/resources.rb @@ -12,8 +12,6 @@ module Filter::Resources kind = resource.class.model_name.plural send "#{kind}=", send(kind).without(resource) empty? ? destroy! : save! - rescue ActiveRecord::RecordNotUnique - destroy! end def buckets diff --git a/test/models/filter_test.rb b/test/models/filter_test.rb index 7635d0ff7..6d871326c 100644 --- a/test/models/filter_test.rb +++ b/test/models/filter_test.rb @@ -89,11 +89,6 @@ class FilterTest < ActiveSupport::TestCase assert_includes filter.as_params[:bucket_ids], buckets(:writebook).id assert_includes filter.buckets, buckets(:writebook) - users(:david).filters.create! tag_ids: [ tags(:mobile).id, tags(:web).id ], bucket_ids: [ buckets(:writebook).id ] - assert_difference "Filter.count", -1 do - tags(:web).destroy! - end - assert_changes "filter.reload.updated_at" do tags(:mobile).destroy! end