如何显示来自Cloudinary / attachary的图像

时间:2018-08-02 09:23:58

标签: ruby-on-rails cloudinary

我目前正在研究一种显示Cloudinary图像的方法。这些图像将附加到Public Sub test() Dim rng As Range Dim aNumber As Variant Dim rowNum As Long Dim rep As Worksheet Dim pwr As Worksheet Set rep = Sheets("REPORT") Set pwr = Sheets("PWRESET") Application.ScreenUpdating = False lastrow = rep.Cells(Rows.Count, "B").End(xlUp).Row For x = 2 To lastrow aNumber = rep.Range("B" & x).Value Set rng = pwr.Range("A1:A2000") If Not IsError(Application.Match(aNumber, rng, 0)) Then rowNum = Application.Match(aNumber, rng, 0) Else Next End If Next x Application.ScreenUpdating = True End Sub

这就是我想出的:

Declaration model

但是我仅有的是损坏的图像和下面的链接。

根据Figaro宝石,我的ENV存放在我的<% 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 %> 中。

我做错了什么?

谢谢。

更新

这就是它给我带来的回报

http://res.cloudinary.com/prs/image/upload/%23%3CAttachinary::File:0x00007f9dd2130408%3E

我的application.yml如下:

declaration.rb

1 个答案:

答案 0 :(得分:0)

您没有指定如何在声明对象中定义facture,但看起来确实像Rails认为它是Attachinary::File对象一样。

cl_image_path(declaration.facture.path)对您来说会更好吗?