Created
August 14, 2011 21:47
-
-
Save seamusjr/1145350 to your computer and use it in GitHub Desktop.
loop collection images paperclip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% for asset in @post.assets %> | |
<li><%= link_to image_tag(asset.asset.url(:thumb)), asset.asset.url(:original) %></li> | |
<% end %> |
ok, sorry. that code was only for show.html.erb
but I am trying to view images in index.html.erb, how to do this? thanks, and thanks for your screencast, it's really good
one more thing, how can I limit the uploaded images? For ex. if I upload 5 images and then edit that post, I can upload another 5 images, and I end up having 10 images per post.
Thanks for this one too.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
undefined method `assets' for nil:NilClass
Extracted source (around line #12):
9:
10:
<% link_to post.title, post_path(post) %>
11:
12: <% for asset in @post.assets %>
13:
14:
15:
please help