add has_may requested_merge_from

This commit is contained in:
simon lehericey 2021-11-04 15:51:54 +01:00
parent d1162d7493
commit 17d131b3cc
2 changed files with 3 additions and 1 deletions

View file

@ -61,7 +61,7 @@ module Users
end
def users_requesting_merge
@requesting_merge ||= User.where(requested_merge_into: current_user)
@requesting_merge ||= current_user.requested_merge_from
end
def ensure_update_email_is_authorized

View file

@ -49,6 +49,8 @@ class User < ApplicationRecord
has_many :dossiers_invites, through: :invites, source: :dossier
has_many :deleted_dossiers
has_many :merge_logs, dependent: :destroy
has_many :requested_merge_from, class_name: 'User', dependent: :nullify, inverse_of: :requested_merge_into, foreign_key: :requested_merge_into_id
has_one :france_connect_information, dependent: :destroy
belongs_to :instructeur, optional: true, dependent: :destroy
belongs_to :administrateur, optional: true, dependent: :destroy