From c8059ccd6bf5be817f87b0a708b9049acf9c741d Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sat, 15 Jan 2022 11:08:58 +0100 Subject: [PATCH] Fix namespace resolution in relationship use cases --- lib/use_case/relationship/create.rb | 6 +++--- lib/use_case/relationship/destroy.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/use_case/relationship/create.rb b/lib/use_case/relationship/create.rb index 61d7cbcf..54f61f39 100644 --- a/lib/use_case/relationship/create.rb +++ b/lib/use_case/relationship/create.rb @@ -37,15 +37,15 @@ module UseCase def find_source_user user_id = @current_user_id - User.find(user_id) + ::User.find(user_id) rescue ActiveRecord::RecordNotFound raise Errors::UserNotFound end def find_target_user target_user = @target_user - return target_user if target_user.is_a?(User) - User.find_by!(screen_name: target_user) + return target_user if target_user.is_a?(::User) + ::User.find_by!(screen_name: target_user) rescue ActiveRecord::RecordNotFound raise Errors::UserNotFound end diff --git a/lib/use_case/relationship/destroy.rb b/lib/use_case/relationship/destroy.rb index 0b0fcf54..3788f38c 100644 --- a/lib/use_case/relationship/destroy.rb +++ b/lib/use_case/relationship/destroy.rb @@ -37,15 +37,15 @@ module UseCase def find_source_user user_id = @current_user_id - User.find(user_id) + ::User.find(user_id) rescue ActiveRecord::RecordNotFound raise Errors::UserNotFound end def find_target_user target_user = @target_user - return target_user if target_user.is_a?(User) - User.find_by!(screen_name: target_user) + return target_user if target_user.is_a?(::User) + ::User.find_by!(screen_name: target_user) rescue ActiveRecord::RecordNotFound raise Errors::UserNotFound end