From 72f0f577a18800f2aa61b69d28ff50f267f05b18 Mon Sep 17 00:00:00 2001 From: nilsding Date: Sun, 14 Dec 2014 12:13:05 +0100 Subject: [PATCH] case insensitive user names in URLs? why the heck knot! --- app/controllers/user_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 0d8f6784..32d0229f 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -1,6 +1,6 @@ class UserController < ApplicationController def show - @user = User.find_by_screen_name!(params[:username]) + @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first @answers = @user.answers.reverse_order.paginate(page: params[:page]) respond_to do |format| format.html @@ -23,7 +23,7 @@ class UserController < ApplicationController def followers @title = 'Followers' - @user = User.find_by_screen_name!(params[:username]) + @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first @users = @user.followers.reverse_order.paginate(page: params[:page]) @type = :friend render 'show_follow' @@ -31,7 +31,7 @@ class UserController < ApplicationController def friends @title = 'Following' - @user = User.find_by_screen_name!(params[:username]) + @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first @users = @user.friends.reverse_order.paginate(page: params[:page]) @type = :friend render 'show_follow'