This is a code snippet for a form upload in ruby on rails, to retain an uploaded image in ruby on rails ==>
<% if blog.image.present? %> <%= form.file_field :image %> <%= image_tag form.object.image, width: "100px" %> <% else %> <%= form.file_field :image %> <% end %>
The Record here is "blog" => [blog model]
And the field is "image"
The "show page output" would look like ==> @blog.image ==><%= image_tag @blog.image %>
If in the code above <% if blog.image.present? %> doesn't work for you, then try <% if blog.image.exists? %>
Ruby on Rails developer, AWS Engineer, anything fun, music, a little bit of mobile game. . .