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:
parent
59faa4e545
commit
c964c15196
@ -12,8 +12,15 @@ class Submission < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def submission_value(value)
|
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)
|
Time.now.utc.to_formatted_s(:rfc822)
|
||||||
|
when ActionDispatch::Http::UploadedFile
|
||||||
|
''
|
||||||
else
|
else
|
||||||
value.to_s
|
value.to_s
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user