I'm currently working on a way to display images from Cloudinary. Those images are attached to the Declaration model
.
Here's what I came up with :
<% 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 %>
But all I have is a broken image and a link below.
My ENV are stocked into my application.yml
according to the figaro gems.
What am I doin wrong ?
thanks.
UPDATE
Here's what it returns me
http://res.cloudinary.com/prs/image/upload/%23%3CAttachinary::File:0x00007f9dd2130408%3E
My declaration.rb
looks like this :
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