[#2622] Change displayed_fields to proper JSONB

This commit is contained in:
Frederic Merizen 2018-09-20 17:05:58 +02:00
parent a3cb2356cf
commit 68608307ad
4 changed files with 12 additions and 11 deletions

View file

@ -102,11 +102,9 @@ module NewGestionnaire
fields = values.map do |value|
table, column = value.split("/")
c = procedure.fields.find do |field|
procedure.fields.find do |field|
field['table'] == table && field['column'] == column
end
c.to_json
end
procedure_presentation.update(displayed_fields: fields)

View file

@ -1,12 +1,6 @@
class ProcedurePresentation < ApplicationRecord
belongs_to :assign_to
def displayed_fields
read_attribute(:displayed_fields).map do |field|
field = JSON.parse(field)
end
end
def sort
JSON.parse(read_attribute(:sort))
end