I want to render an image that a user uploads in a PDF.
I am saving the image to the current Rails directory public
folder.
Images are being saved at the moment inside the public folder.
Everything works in development but when in production, it is thinking that the image is part of the assets and raises the "image is not in the assets" error.
In development, it is looking at the correct path inside the public folder.
In production with the code below, it looks at public/public
for the image.
This is the code that I have in my view that renders the PDF.
<% @images.each do |image| %>
<% if Rails.env != "development" %>
<%= wicked_pdf_image_tag ("public/#{image.original_filename}")%>
<% else %>
<%= wicked_pdf_image_tag(image.original_filename)%>
<% end %>
<% end %>
I tried using
wicked_pdf_image_tag("public/#{image.original_filename}")
but it returns an assets error since its looking inside public/assets folder.
I also tried using
wicked_pdf_image_tag("/public#{image.original_filename}")
but it results in public/public folder, which the image is not inside there but instead one level up.
When I try to retrieve the image I expect for the wicked_pdf_image_tag
to look at the public/
folder for the image.