Factorize some code in Dossier#serialize_value_for_export
This commit is contained in:
parent
ae5b4f6249
commit
1db37894c2
1 changed files with 6 additions and 2 deletions
|
@ -210,7 +210,7 @@ class Dossier < ActiveRecord::Base
|
||||||
def convert_specific_hash_values_to_string(hash_to_convert)
|
def convert_specific_hash_values_to_string(hash_to_convert)
|
||||||
hash = {}
|
hash = {}
|
||||||
hash_to_convert.each do |key, value|
|
hash_to_convert.each do |key, value|
|
||||||
value = value.to_s if !value.kind_of?(Time) && !value.nil?
|
value = serialize_value_for_export(value)
|
||||||
hash.store(key, value)
|
hash.store(key, value)
|
||||||
end
|
end
|
||||||
return hash
|
return hash
|
||||||
|
@ -218,7 +218,7 @@ class Dossier < ActiveRecord::Base
|
||||||
|
|
||||||
def full_data_strings_array
|
def full_data_strings_array
|
||||||
data_with_champs.map do |value|
|
data_with_champs.map do |value|
|
||||||
value.nil? || value.kind_of?(Time) ? value : value.to_s
|
serialize_value_for_export(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -303,4 +303,8 @@ class Dossier < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def serialize_value_for_export(value)
|
||||||
|
value.nil? || value.kind_of?(Time) ? value : value.to_s
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue