[#3477] Make sanitized_column dryer

This commit is contained in:
Frederic Merizen 2019-02-26 19:12:05 +01:00 committed by Frederic Merizen
parent 1f34d971d1
commit 00ca2e0cbb

View file

@ -270,10 +270,9 @@ class ProcedurePresentation < ApplicationRecord
def sanitized_column(field)
table = field['table']
table = ActiveRecord::Base.connection.quote_column_name((table == 'self' ? 'dossier' : table).pluralize)
column = ActiveRecord::Base.connection.quote_column_name(field['column'])
table + '.' + column
[(table == 'self' ? 'dossier' : table).pluralize, field['column']]
.map { |name| ActiveRecord::Base.connection.quote_column_name(name) }
.join('.')
end
def dossier_field_service