From 6249465b349037f7f110573eca74e2f3c87dd387 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Thu, 21 Oct 2021 15:51:17 +0200 Subject: [PATCH] Fixed updating user assignment in MyModuleMember [SCI-6169] --- app/models/my_module_member.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/my_module_member.rb b/app/models/my_module_member.rb index 3758e3fb9..4acb2772c 100644 --- a/app/models/my_module_member.rb +++ b/app/models/my_module_member.rb @@ -22,7 +22,7 @@ class MyModuleMember end def update(params) - user_assignment(params) + initialize_user_assignment!(params) ActiveRecord::Base.transaction do user_assignment.update!(user_role: user_role, assigned: :manually) @@ -32,13 +32,13 @@ class MyModuleMember private - def user_assignment(params) + def initialize_user_assignment!(params) self.user_role_id = params[:user_role_id] self.user_id = params[:user_id] @user = @project.users.find(user_id) @user_role = UserRole.find_by(id: user_role_id) - @user_assignment ||= UserAssignment.find_by(assignable: my_module, user: user) + @user_assignment = UserAssignment.find_by(assignable: my_module, user: user) end def log_change_activity