I am currently using Active Storage to upload images. However, when I attempt to display the image on the Active Admin index, I receive a "No webpage was found for the web address page not found" error on the first attempt. Strangely, when I try again using the same link, the image displays without a problem. It seems like the result is being toggled. Everything works fine in localhost, but I'm experiencing issues in production.
Here is the code I'm using in the model:
has_one_attached :logo, dependent: :destroy
And the code in my storage.yml file:
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
Here is the code I'm using in the Active Admin index:
index do
selectable_column
id_column
column :logo, sortable: false do |s|
if s.logo.attached?
link_to "Logo Link", url_for(s.logo), target: "_blank"
else
"Logo not attached"
end
end
actions
end