make search for users case insensitive [fixes SCI-1192]

This commit is contained in:
zmagod 2017-04-25 15:33:51 +02:00
parent 92159b734f
commit 615bbb9967

View file

@ -55,7 +55,9 @@ class Team < ActiveRecord::Base
def search_users(query = nil)
a_query = "%#{query}%"
users.where.not(confirmed_at: nil)
.where('full_name LIKE ? OR email LIKE ?', a_query, a_query)
.where('lower(full_name) LIKE ? OR lower(email) LIKE ?',
a_query.downcase,
a_query.downcase)
end
# Imports samples into db