aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/concerns
diff options
context:
space:
mode:
authorZog2018-03-13 10:41:48 +0100
committerJohan Van Ryseghem2018-04-04 11:10:39 +0200
commitd034376737c27e48a7a3413b82461a65999ee105 (patch)
treec657811ee569ce1f2487c07f921fdae3382eb726 /app/models/concerns
parenta77307ca49c57dc18823f6aece2424ccb3c5a7c2 (diff)
downloadchouette-core-d034376737c27e48a7a3413b82461a65999ee105.tar.bz2
Refs #6090; CustomFields inputs made easy
:warning: We'll have to refine this code once StopArea are linked to workgroups
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/custom_fields_support.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/concerns/custom_fields_support.rb b/app/models/concerns/custom_fields_support.rb
index 7d2c22537..6565ac808 100644
--- a/app/models/concerns/custom_fields_support.rb
+++ b/app/models/concerns/custom_fields_support.rb
@@ -15,13 +15,14 @@ module CustomFieldsSupport
def custom_field_values= vals
out = {}
- vals.each do |k, val|
- out[k] = custom_fields[k]&.preprocess_value_for_assignment(val)
+ custom_fields.each do |code, field|
+ out[code] = field.preprocess_value_for_assignment(vals[code])
end
self.write_attribute :custom_field_values, out
end
def initialize_custom_fields
+ self.custom_field_values ||= {}
custom_fields.values.each &:initialize_custom_field
end