Skip to content

Commit

Permalink
Update taxon icon to use present instead of exists
Browse files Browse the repository at this point in the history
`Exists` on a paperclip object attempts to access the image where
it's stored, whereas present just checks if the object exists on
Solidus.

Using exists here causes an error if the image doesn't exist. Luckily,
paperclip double checks that the image filename is present before
attempting to fetch it from the storage service, but paperclip_cloudinary
does not do this, meaning that any store using paperclip_cloudinary is
unable to view the admin taxon edit page for taxons without icons.
  • Loading branch information
seand7565 committed Jan 6, 2021
1 parent c7025ee commit 6e19cd7
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -2,7 +2,7 @@
<%= f.field_container attachment do %>
<%= f.label attachment %><br>
<%= f.file_field attachment %>
<% if f.object.send(attachment).exists? %>
<% if f.object.send(attachment).present? %>
<%= image_tag f.object.send(attachment, definition[:default_style]) %>
<%= link_to t('spree.actions.remove'),
admin_taxonomy_taxon_attachment_path(@taxonomy,
Expand Down

0 comments on commit 6e19cd7

Please sign in to comment.