From 502c594aca648939732a8df9ddf9cd120f8086ce Mon Sep 17 00:00:00 2001 From: Stanley Liu Date: Tue, 11 Aug 2020 11:43:24 +0100 Subject: [PATCH] added dependent destroy on pages categories to allow deletion --- config/initializers/comfy_patching.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/comfy_patching.rb b/config/initializers/comfy_patching.rb index 94c21f394..e0b561eda 100644 --- a/config/initializers/comfy_patching.rb +++ b/config/initializers/comfy_patching.rb @@ -1,6 +1,6 @@ Rails.configuration.to_prepare do Comfy::Cms::Page.class_eval do - has_many :pages_categories, foreign_key: 'page_id' + has_many :pages_categories, foreign_key: 'page_id', dependent: :destroy has_many :page_categories, through: :pages_categories, foreign_key: 'page_id' has_many :topics, -> { joins(:layout_category).where("comfy_cms_layout_categories.label = 'topics'") },