From 17a6756bcb8634642f25fb03811dd360ed776d83 Mon Sep 17 00:00:00 2001 From: 2458773093 <2458773093@protonmail.com> Date: Tue, 16 Jul 2019 09:43:31 +0300 Subject: [PATCH] group_removed_users associations --- app/models/group.rb | 3 +++ app/models/group_removed_account.rb | 2 ++ 2 files changed, 5 insertions(+) diff --git a/app/models/group.rb b/app/models/group.rb index 562c24a1..5b62a208 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -28,6 +28,9 @@ class Group < ApplicationRecord has_many :group_accounts, inverse_of: :group, dependent: :destroy has_many :accounts, through: :group_accounts + has_many :group_removed_accounts, inverse_of: :group, dependent: :destroy + has_many :removed_accounts, source: :account, through: :group_removed_accounts + validates :title, presence: true validates :description, presence: true diff --git a/app/models/group_removed_account.rb b/app/models/group_removed_account.rb index 0f509708..5b6f1a6d 100644 --- a/app/models/group_removed_account.rb +++ b/app/models/group_removed_account.rb @@ -10,4 +10,6 @@ # class GroupRemovedAccount < ApplicationRecord + belongs_to :group + belongs_to :account end