Fix bug PG::AmbiguousColumn on PreferenceListDossier

This commit is contained in:
Xavier J 2016-10-10 14:56:23 +02:00
parent 2a2ccec373
commit dd75a58a6c
2 changed files with 3 additions and 1 deletions

View file

@ -8,7 +8,7 @@ class PreferenceListDossier < ActiveRecord::Base
end
def table_with_s_attr
return self.attr if table.nil? || table.empty?
return 'dossiers.'+self.attr if table.nil? || table.empty?
table + 's' + '.' + attr
end

View file

@ -105,7 +105,9 @@ class DossiersListGestionnaireService
filter = "%"+filter+"%" unless filter.include? '%'
acc += (acc.to_s.empty? ? ''.to_s : " AND ") +
"CAST(" +
preference.table_with_s_attr +
" as TEXT)" +
" LIKE " +
"'" +
filter +