Duh, no before destroy commit, but this is still not right!

This commit is contained in:
David Heinemeier Hansson
2025-04-22 21:40:30 +02:00
parent 7124835e60
commit 5048e9c970
+3 -1
View File
@@ -5,10 +5,12 @@ module Filterable
has_and_belongs_to_many :filters
after_update { filters.touch_all }
before_destroy_commit :remove_from_filters
before_destroy :remove_from_filters
end
private
# FIXME: This is too inefficient to have part of a destroy transaction.
# Need to find a way to use a job or a single query.
def remove_from_filters
filters.each { it.resource_removed self }
end