From 36c6d8e6b7492fc8be203e2849afc52d9ac30fcc Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Fri, 25 Feb 2022 15:54:57 -0300 Subject: [PATCH] 18801: Fixes the regression by ignoring the case where api_token isn't there. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- services/api/app/models/api_client_authorization.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/api/app/models/api_client_authorization.rb b/services/api/app/models/api_client_authorization.rb index c74c1ce5bf..993a49e5b7 100644 --- a/services/api/app/models/api_client_authorization.rb +++ b/services/api/app/models/api_client_authorization.rb @@ -35,7 +35,12 @@ class ApiClientAuthorization < ArvadosModel UNLOGGED_CHANGES = ['last_used_at', 'last_used_by_ip_address', 'updated_at'] def assign_random_api_token - self.api_token ||= rand(2**256).to_s(36) + begin + self.api_token ||= rand(2**256).to_s(36) + rescue ActiveModel::MissingAttributeError + # Ignore the case where self.api_token doesn't exist, which happens when + # the select=[...] is used. + end end def owner_uuid -- 2.30.2