Im trying to display an attached pdf which is stored on Amazon S3 on the model's show view, but I can't get it to work.
So far my best attempt was to get the uploaded file's url on s3 like this :
#controller.rb
@key = upload.file.service_url
which successfully gets the URL of the file, and display it with iframe in the view. Which sadly doesn't work.
#view.html.erb
<iframe src=" <% @key %> " width="100%" height="500px">
It produces this:
My Upload model:
class Upload < ApplicationRecord
belongs_to :user
has_one_attached :file
end
Thanks a lots
