From 096befa2ef0b4518c5f99c24d199bd1a3fb729c3 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Fri, 7 Oct 2016 02:53:20 +0300 Subject: [PATCH] Destroy proposables that depend on a proposition --- app/models/proposition.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/proposition.rb b/app/models/proposition.rb index c3ab063..0fd16f2 100644 --- a/app/models/proposition.rb +++ b/app/models/proposition.rb @@ -1,6 +1,6 @@ class Proposition < ActiveRecord::Base belongs_to :proposer, class_name: 'User' - belongs_to :proposable, polymorphic: true + belongs_to :proposable, polymorphic: true, dependent: :destroy enum status: [:undecided, :approved, :rejected, :backup] delegate :proposable_title, :proposable_type, :proposable_description, to: :proposable