[fix #1097] Accent insensitive search

This commit is contained in:
simon lehericey 2018-01-08 14:59:23 +01:00 committed by Simon Lehericey
parent 6a2b575027
commit 2bc61f9f3f
4 changed files with 13 additions and 3 deletions

View file

@ -14,7 +14,7 @@ class FindDubiousProceduresJob < ApplicationJob
# https://www.postgresql.org/docs/current/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP
forbidden_tdcs = TypeDeChamp
.joins(:procedure)
.where("types_de_champ.libelle ~* '#{forbidden_regexp}'")
.where("unaccent(types_de_champ.libelle) ~* unaccent('#{forbidden_regexp}')")
.where(type_champ: %w(text textarea))
.where(procedures: { archived_at: nil, whitelisted_at: nil })