diff options
| author | Zog | 2018-04-26 17:31:32 +0200 |
|---|---|---|
| committer | Zog | 2018-04-26 17:31:42 +0200 |
| commit | 71435c4c221464dfc6cc0150e89393e3bcb74e5e (patch) | |
| tree | faf2c606ca75b2542412d05f8d4930a58cc61638 /app | |
| parent | 715917bf6503a06d7d7c130b8b007525dc52742e (diff) | |
| download | chouette-core-71435c4c221464dfc6cc0150e89393e3bcb74e5e.tar.bz2 | |
Fix `Attachment` Custom Field
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/concerns/custom_fields_support.rb | 3 | ||||
| -rw-r--r-- | app/models/custom_field.rb | 2 |
2 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 6e744d550..6b6621d0c 100644 --- a/app/models/concerns/custom_fields_support.rb +++ b/app/models/concerns/custom_fields_support.rb @@ -42,6 +42,7 @@ module CustomFieldsSupport end @custom_fields_values_initialized = true else + @raw_custom_fields_values = vals out = vals end write_attribute :custom_field_values, out @@ -65,7 +66,7 @@ module CustomFieldsSupport custom_field_values[k] ||= v.default_value end @custom_fields_initialized = true - self.custom_field_values = self.custom_field_values unless custom_fields_values_initialized? + self.custom_field_values = (@raw_custom_fields_values || self.custom_field_values) unless custom_fields_values_initialized? end def custom_field_value key diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index b5c08465d..deb0326f8 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -244,7 +244,7 @@ class CustomField < ApplicationModel end def preprocess_value_for_assignment val - if val.present? + if val.present? && !val.is_a?(Hash) owner.send "#{uploader_name}=", val else @raw_value |
