From 1aabfcb92d41f690e6756a7f057e85f17e30a0db Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 26 Mar 2014 12:45:39 +0100 Subject: [PATCH] Change the user search query to be case insensitive. --- CHANGELOG | 1 + app/models/user.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 0b295e4..06d19df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion - Enabled GZip Compression for assets in example Nginx, make sure that Nginx is compiled with --with-http_gzip_static_module flag (this is default in Ubuntu) + - Make user search case-insensitive (Christopher Arnold) v 6.7.2 - Fix upgrader script diff --git a/app/models/user.rb b/app/models/user.rb index d9f4207..25c10a6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -204,7 +204,7 @@ class User < ActiveRecord::Base end def search query - where("name LIKE :query OR email LIKE :query OR username LIKE :query", query: "%#{query}%") + where("lower(name) LIKE :query OR lower(email) LIKE :query OR lower(username) LIKE :query", query: "%#{query.downcase}%") end def by_username_or_id(name_or_id) -- libgit2 0.21.2