mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-21 22:29:38 +02:00
fix: Ghost subcategories when parent category is deleted (#1874)
This commit is contained in:
parent
79e1a2c0ff
commit
c620d1fc1e
1 changed files with 1 additions and 1 deletions
|
@ -5,7 +5,7 @@ class Category < ApplicationRecord
|
|||
belongs_to :family
|
||||
|
||||
has_many :budget_categories, dependent: :destroy
|
||||
has_many :subcategories, class_name: "Category", foreign_key: :parent_id
|
||||
has_many :subcategories, class_name: "Category", foreign_key: :parent_id, dependent: :nullify
|
||||
belongs_to :parent, class_name: "Category", optional: true
|
||||
|
||||
validates :name, :color, :family, presence: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue