From d4da6502ba7f1773e8ee42c481a0173b638f223e Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 10 Mar 2022 17:34:56 +0100 Subject: [PATCH] models: remove double-write callback on User --- app/models/user.rb | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 9c0467b13..441737c09 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -65,21 +65,6 @@ class User < ApplicationRecord validate :does_not_merge_on_self, if: :requested_merge_into_id_changed? - # Temporary code for double writing the admin, instructeur and expert id to the foreign key - after_save do - if saved_change_to_attribute?(:administrateur_id) && administrateur_id.present? - Administrateur.find(administrateur_id).update!(user_id: id) - end - - if saved_change_to_attribute?(:instructeur_id) && instructeur_id.present? - Instructeur.find(instructeur_id).update!(user_id: id) - end - - if saved_change_to_attribute?(:expert_id) && expert_id.present? - Expert.find(expert_id).update!(user_id: id) - end - end - def validate_password_complexity? administrateur? end