From 2edfcdd6522d949b35c860b939d4ece60320f8cb Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 31 Jan 2023 16:06:31 +0100 Subject: [PATCH] =?UTF-8?q?correctif(liens.invitations):=20utilise=20le=20?= =?UTF-8?q?mapping=20rails=20as:=20:target=5Fmodel,=20sinon=20on=20requete?= =?UTF-8?q?=20uniquement=20par=20l'id=20du=20model,=20qui=20peut=20etre=20?= =?UTF-8?q?probl=C3=A9matique=20en=20cas=20de=20relation=20polymorphiques?= =?UTF-8?q?=20avec=20des=20ensembles=20d'id=20se=20superposant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/avis.rb | 2 +- app/models/invite.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/avis.rb b/app/models/avis.rb index 334625fe7..9efa98164 100644 --- a/app/models/avis.rb +++ b/app/models/avis.rb @@ -28,7 +28,7 @@ class Avis < ApplicationRecord has_one :expert, through: :experts_procedure has_one :procedure, through: :experts_procedure - has_many :targeted_user_links, dependent: :destroy, inverse_of: :target_model, foreign_key: 'target_model_id' + has_many :targeted_user_links, as: :target_model, dependent: :destroy, inverse_of: :target_model FILE_MAX_SIZE = 20.megabytes validates :piece_justificative_file, diff --git a/app/models/invite.rb b/app/models/invite.rb index 3b9031856..dbdfd3a67 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -16,7 +16,7 @@ class Invite < ApplicationRecord belongs_to :dossier, optional: false belongs_to :user, optional: true - has_one :targeted_user_link, dependent: :destroy, inverse_of: :target_model, foreign_key: 'target_model_id' + has_one :targeted_user_link, as: :target_model, dependent: :destroy, inverse_of: :target_model before_validation -> { sanitize_email(:email) }