Change the user search query to be case insensitive.

This commit is contained in:
Marin Jankovski 2014-03-26 12:45:39 +01:00
parent 961d87937b
commit 1aabfcb92d
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -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)