From c964c15196b7c6c3fc4dc5a37ffc6803d023a6e3 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Wed, 8 Apr 2020 00:50:35 +0200 Subject: [PATCH] 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 --- app/models/submission.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/submission.rb b/app/models/submission.rb index db3d510..2118688 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -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