1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

Allow searching by username

This commit is contained in:
Guilherme Chaguri 2022-09-26 13:41:50 -03:00
parent c6f0b69b2e
commit 1bd97e3251

View File

@ -54,7 +54,8 @@ class Members::ListService
.where("users.is_active = 'true'") .where("users.is_active = 'true'")
.limit(50) .limit(50)
query.downcase.split(' ').each do |word| query.downcase.split(' ').each do |word|
members = members.where('lower(f_unaccent(profiles.first_name)) ~ :search OR ' \ members = members.where('lower(f_unaccent(users.username)) ~ :search OR ' \
'lower(f_unaccent(profiles.first_name)) ~ :search OR ' \
'lower(f_unaccent(profiles.last_name)) ~ :search', 'lower(f_unaccent(profiles.last_name)) ~ :search',
search: word) search: word)
end end