From 99fddb45d1b75f28879e5b5cc24b47386f5c0b88 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 19 Jun 2023 11:29:48 +0200
Subject: [PATCH] dependent destroy

---
 app/models/user/with_favorites.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/models/user/with_favorites.rb b/app/models/user/with_favorites.rb
index 609ec46ba..d5a71a3b2 100644
--- a/app/models/user/with_favorites.rb
+++ b/app/models/user/with_favorites.rb
@@ -2,7 +2,7 @@ module User::WithFavorites
   extend ActiveSupport::Concern
 
   included do
-    has_many :favorites
+    has_many :favorites, dependent: :destroy
   end
 
   def add_favorite(about)
-- 
GitLab