How do I display my uploaded picture?
In my view, I have this to upload an avatar. When I want to edit, the picture is gone and how do I view my uploaded picture in my show view? I don't make use of any gems.
<div class="inputfield">
<%= f.label :avatar %>
<%= f.label :avatar do %>
<%= image_tag("avatarbackground", class: "avatar-bg",
alt: "avatar image", id: "avatar-background", type:
"file") %>
<% end %>
<%= f.file_field :avatar, class: "hidden" %>
<%= f.hidden_field :avatar_cache %>
</div>
In my show view I use this:
<%= image_tag image_url(@store.avatar) %>
<div class="inputfield">
<%= f.label :avatar %>
<% if @store.avatar %>
<%= image_tag(@store.avatar, class: "avatar-bg", alt: "avatar image", id: "avatar-background", type: "file") %>
<% end %>
<%= f.file_field :avatar, label: "Avatar" %>
</div>
Hi John, then I get "The asset "avatar.jpeg" is not present in the asset pipeline."
I am missing something I think.