fix: handle nil safely for latest arts image
- Update image tag to safely access the first latest art - Use safe navigation operator to prevent potential nil errors This change ensures that if there are no latest arts or if the image is not attached, the application will not raise an error. It improves the robustness of the view by handling edge cases.
This commit is contained in:
parent
789e9f8d23
commit
c35f09660a
@ -3,7 +3,7 @@
|
||||
<section class="h-screen-90 relative overflow-hidden">
|
||||
<% if @latest_arts.first&.image&.attached? %>
|
||||
<div class="absolute inset-0">
|
||||
<%= image_tag @latest_arts.first.webp_image.processed, class: "w-full h-full object-cover" %>
|
||||
<%= image_tag @latest_arts&.first&.webp_image&.processed, class: "w-full h-full object-cover" %>
|
||||
<div class="absolute inset-0 bg-gradient-to-r from-base-100/90 to-base-100/50"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
Loading…
Reference in New Issue
Block a user