Fix user deletion foreign key constraint with invitations (#2357)

This commit was merged in pull request #2357.
This commit is contained in:
Huy Nguyen Quang
2025-06-12 08:26:31 +07:00
committed by GitHub
parent 5a4c955522
commit cdad31812a

View File

@@ -5,6 +5,7 @@ class User < ApplicationRecord
belongs_to :last_viewed_chat, class_name: "Chat", optional: true
has_many :sessions, dependent: :destroy
has_many :chats, dependent: :destroy
has_many :invitations, foreign_key: :inviter_id, dependent: :destroy
has_many :impersonator_support_sessions, class_name: "ImpersonationSession", foreign_key: :impersonator_id, dependent: :destroy
has_many :impersonated_support_sessions, class_name: "ImpersonationSession", foreign_key: :impersonated_id, dependent: :destroy
accepts_nested_attributes_for :family, update_only: true