[BugFix] Fix Users not deletable because of foreign key reference (#300)

Fixes #297
This commit is contained in:
Sojan Jose
2019-11-27 09:01:39 +05:30
committed by Sony Mathew
parent 274ad381cb
commit cbf2d27b6b
3 changed files with 9 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ class User < ApplicationRecord
belongs_to :account
belongs_to :inviter, class_name: 'User', required: false
has_many :invitees, class_name: 'User', foreign_key: 'inviter_id', dependent: :nullify
has_many :assigned_conversations, foreign_key: 'assignee_id', class_name: 'Conversation', dependent: :nullify
has_many :inbox_members, dependent: :destroy