i want to search for users ignoring the accents i tried to use I18n.transliterate and it worked, but i don't know how to use it in search results
def list
page = get_pagination_params[:page] || 1
results = User.page(page).per(Settings.pagination.per_page)
search_params = get_search_params()
@text = search_params[:text] if search_params[:text].present?
results = results.where('name ILIKE ?', "%#{search_params[:text]}%") if @text.present? && @text != ''
#@text = I18n.transliterate(@text) if search_params[:text].present?
@role = search_params[:role] if search_params[:role].present?
results = @role.present? ? results.where(role: @role) : results.where.not(role: [:guest, :quiz_candidate, :client])
@users = results
end
Aucun commentaire:
Enregistrer un commentaire