Model:
class Image < ApplicationRecord
has_one_attached :picture
end
Check if pictured is attached before displaying
<p>
<strong>picture:</strong>
<%= image_tag @image.picture if @image.picture.attached? %>
</p>
Check if pictured is attached before displaying with variant
<td>
<% if image.picture.attached? %>
<%= image_tag image.picture.variant(resize: "100x100") %>
<% end %>
</td>