Skip to content

Instantly share code, notes, and snippets.

@crivotz
Created July 17, 2019 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crivotz/5228cf58c00911b29a1493d11c6c02bd to your computer and use it in GitHub Desktop.
Save crivotz/5228cf58c00911b29a1493d11c6c02bd to your computer and use it in GitHub Desktop.
<% @post.uploads.each do |upload| %>
<% if upload.variable? %>
<%= link_to image_tag(upload.variant(resize: "400x400")), upload %>
<% elsif upload.previewable? %>
<%= link_to image_tag(upload.preview(resize: "400x400")), rails_blob_path(upload, disposition: :attachment) %>
<% elsif upload.image? %>
<%= link_to image_tag(upload, width: 400), upload %>
<% else %>
<%= link_to upload.filename, rails_blob_path(upload, disposition: :attachment) %>
<% end %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment