Form value handling for Arrays and Hashes

This processes Array and Hash values and converts those to strings that
can be appended to the spreadsheet
This commit is contained in:
bumi 2020-04-08 00:50:35 +02:00
parent 59faa4e545
commit c964c15196

View File

@ -12,8 +12,15 @@ class Submission < ApplicationRecord
end
def submission_value(value)
if value.to_s.downcase == 'tinyforms_now'
case value
when Array
value.join(', ')
when Hash
JSON.dump(value)
when 'tinyforms_now'
Time.now.utc.to_formatted_s(:rfc822)
when ActionDispatch::Http::UploadedFile
''
else
value.to_s
end