Check whether a Paperclip attachment exists: I'm trying to see if the attachment has selected a file/image then something will happen like this new view to appear. So after i click browse select an Image I want something to happen!! Thanks!
Nothing happens when i do this code!
home view:
<% if @post.image.present? %>
<%= render 'posts' %>
<% end %>
You should use the
exists?orfile?methods.exists?: will check if the file actually exist (slow)file?: will only check if there is a value in db (faster).