【发布时间】:2019-01-10 00:19:46
【问题描述】:
我目前正在研究一种从 Cloudinary 显示图像的方法。这些图像附加到Declaration model。
这是我想出的:
<% cache @declarations do %>
<table class="tableau_stats">
<th>IMEI</th>
<th>Prénom</th>
<th>Nom</th>
<th>Adresse</th>
<th>Code postal</th>
<th>Ville</th>
<th>Email</th>
<th>Numéro de téléphone</th>
<th>Créé le</th>
<th>Panne</th>
<th>MDP Icloud</th>
<th>MDP</th>
<% @declarations.each do |declaration| %>
<tr>
<td><%= declaration.imei %></td>
<td><%= declaration.firstname %></td>
<td><%=declaration.lastname%></td>
<td><%=declaration.address %></td>
<td><%=declaration.postal_code %></td>
<td><%=declaration.city%></td>
<td><%= declaration.email %></td>
<td><%= declaration.phone_number %></td>
<td><%= declaration.created_at.strftime("%d.%m.%Y") %></td>
<td><%= declaration.type_outage %></td>
<td><%= declaration.icloud_password %></td>
<td><%= declaration.unlock_code %></td>
<td><%= cl_image_path(declaration.facture) %></td>
</tr>
<% end %>
</table>
<% end %>
但我只有一张破损的图片和下面的链接。
根据 figaro gems,我的 ENV 存储在我的 application.yml 中。
我做错了什么?
谢谢。
更新
这就是它给我的回报
http://res.cloudinary.com/prs/image/upload/%23%3CAttachinary::File:0x00007f9dd2130408%3E
我的declaration.rb 看起来像这样:
class Declaration < ApplicationRecord
has_attachment :facture, accept: [:pdf]
validates_size_of :facture, maximum: 15.megabytes, message: "Le fichier doit être inférieur à 15 megabytes"
validates :facture, presence: true
end
【问题讨论】:
-
能否添加生成的图片标签的源代码?
-
是的,我会编辑我的问题。
-
像@MrShemek 这样看起来更好吗?