1

I've uploaded and encrypted two images to my app, and now I need to use them in an img_tag. How can I retrieve the contents of this string and display them to the user?

Model.document_front: <ActionDispatch::Http::UploadedFile:0x007f91fc5c88d0>
Deepak Mahakale
  • 22,834
  • 10
  • 68
  • 88
calyxofheld
  • 1,538
  • 3
  • 24
  • 62

1 Answers1

1

You should be able to use the path method: https://api.rubyonrails.org/v6.0.0/classes/ActionDispatch/Http/UploadedFile.html#method-i-path

More information here:

https://www.reddit.com/r/rails/comments/8nqssd/actiondispatchhttpuploadedfile/

Clara
  • 2,677
  • 4
  • 16
  • 31
  • The docs say "Uploaded files are temporary files whose lifespan is one request" - is it bad to store them that way? Should uploaded files be saved as something other than `ActionDispatch::Http::UploadedFile`? – calyxofheld Sep 26 '19 at 17:49