From e7a0ff1234ee3cd038f6d251cd3eb0eacbd123af Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Fri, 18 Oct 2024 17:06:13 -0700 Subject: [PATCH] Make deleting an AltStyle also delete its ParentSwfAssetRelationships Not relevant in-app as such, I'm just deleting records to re-test things in development, and it helps to keep things in a more consistent state! --- app/models/alt_style.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/alt_style.rb b/app/models/alt_style.rb index 71ee47ce..4ffdad3f 100644 --- a/app/models/alt_style.rb +++ b/app/models/alt_style.rb @@ -4,7 +4,7 @@ class AltStyle < ApplicationRecord belongs_to :species belongs_to :color - has_many :parent_swf_asset_relationships, as: :parent + has_many :parent_swf_asset_relationships, as: :parent, dependent: :destroy has_many :swf_assets, through: :parent_swf_asset_relationships has_many :contributions, as: :contributed, inverse_of: :contributed