Clear up dependency destruction chain

Buckets destroy their bubbles, which destroy their thread entries, which destroy their threadables, which is how comments end up destroyed, and then rollups end up deleting their events
This commit is contained in:
Jose Farias
2024-10-23 14:51:12 -06:00
parent 3e5b902e76
commit ae497aae85
6 changed files with 17 additions and 5 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
class ThreadEntry < ApplicationRecord
belongs_to :bubble
delegated_type :threadable, types: %w[ Comment Rollup ]
delegated_type :threadable, types: %w[ Comment Rollup ], dependent: :destroy
scope :chronologically, -> { order created_at: :asc, id: :desc }
end