From 3ff89796d4e5e5fe2b907fbd56fac240f05c0b7f Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 4 Jul 2023 03:18:59 -0700 Subject: [PATCH] Downcase username on db end There was a bug where users with capital letters in their name could not access their profiles after we tried to make things case insensitive. --- app/controllers/api/v1/users_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 2f658a1..b1afff2 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -167,11 +167,11 @@ module Api # Specify whitelisted properties that can be modified. def set - @user = User.where('username = ?', params[:id].downcase).first + @user = User.find_by('lower(username) = ?', params[:id].downcase) end def set_by_id - @user = User.where('id = ?', params[:id]).first + @user = User.find_by('id = ?', params[:id]) end def user_params