I am trying to embed an image from Rails' Active Storage into a Prawn PDF.
This is what I've got in my Prawn PDF class:
path = @view.rails_blob_url(@logo, :host => "localhost:3000", :protocol => "http", :locale => nil)
image(path, :vposition => :center)
When I try to open the PDF, I get this error:
ArgumentError in InvoicesController#show http://localhost:3000/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBGdz09IiwiZXhwIjxudWxsHCJwdXIiOiJibG9iX2lkIn19--06167c36c283f6d5de63ae306b721310af11f70e/Test-Logo.png not found
When I copy that exact same URL into my browser, the image shows up as expected. 5 minutes later it expires (?).
What am I missing here?
How can I show the image in my PDF?
Why can the image be rendered in the browser but not in my PDF?
I've spent all day trying to get this to work today, but to no avail.