如何在视图中显示多个上传的回形针?
我对编程非常陌生,并且在 emersonlackey 上关注了此截屏视频。 com 关于添加多个回形针上传以记录。一切都很好,但我不知道如何在记录显示页面中显示上传的图像。
它们在编辑页面上显示良好,使用:
<%= f.fields_for :venuephotos do |photo| %>
<% unless photo.object.new_record? %>
<p>
<%= link_to image_tag(photo.object.venuephoto.url(:thumb)), photo.object.venuephoto.url(:original) %>
<%= photo.check_box :_destroy %>
</p>
<% end %>
<% end %>
我在其他模型中使用过回形针,但它们是标准的,每个记录只有一次上传,因此图像显示良好,<%= @model.photo.url %>输入 call 但我无法以其他方式弄清楚。
非常感谢任何帮助!
I'm very new to programming and have followed this screencast at emersonlackey.com on adding multiple paperclip uploads for a record. It all works great but I can't figure out how to display the uploaded images in the records show page.
They display fine on the edit page using:
<%= f.fields_for :venuephotos do |photo| %>
<% unless photo.object.new_record? %>
<p>
<%= link_to image_tag(photo.object.venuephoto.url(:thumb)), photo.object.venuephoto.url(:original) %>
<%= photo.check_box :_destroy %>
</p>
<% end %>
<% end %>
I've used paperclip in other models but they are the standard each record only has one upload so the images display fine with <%= @model.photo.url %> type call but I cant figure out this other way.
Any help is much apprectiated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想做这样的事情:
按照截屏视频附带的代码。
https://github.com/Emerson/Multiple-File-Uploads-with-Paperclip-and-Rails-3/blob/master/app/views/posts/show.html.erb
You want to do something like this:
as per the code that goes along with the screencast.
https://github.com/Emerson/Multiple-File-Uploads-with-Paperclip-and-Rails-3/blob/master/app/views/posts/show.html.erb