我在paperclip images表中有一个名为resolution_image的boolean列。我想显示字段resolution_image为true的图像,如何显示此图像?
答案 0 :(得分:2)
<%= image_tag @model.picture.url if @model.resolution_image %>
答案 1 :(得分:0)
需要有关您的特定命名约定的更多详细信息,但我们假设以下内容:
model_with_image_attachment
attachment_name
这会在resolution_image
属性为true
时显示图片:
<%= image_tag model_with_image_attachment.attachment_name.url if model_with_image_attachment.resolution_image %>