trying to make link to my recent uploaded image
<%= link_to (image_tag (post.image_url(:thumb))), post.image.url(:original), :class => 'postimage' %>
how ever it’s not working, at all…
<% @post.image do |image| %>
<%= link_to (image_tag (post.image_url(:thumb))), post.image.url(:original), :class => 'postimage' %>
<% end %>
the fun part is that
<%= @post.image %>
works. but only shows /uploads/post/image/3/eKoh3.jpg
full code here https://gist.github.com/4332533
This line looks wrong to me:
(btw your gist actually says
@post.image.each do |image|, which I’m assuming is what you meant to do above)If you are mounting an uploader on your Post model’s
:imageattribute, then this makes no sense. A mounted uploader allows you to upload one image, and you can’t iterate over it usingeach.I’m not sure what you’re trying to do. Are you trying to iterate over all the versions? Try
post.image.versions.eachAre you trying to upload multiple images? Carrierwave can’t help you with that directly. You’ll need to create a new model,
Image, and mount your uploader there. YourPostwill need a line likeAnd your
Imagemodel will need tobelong_to :post. You’ll also need to figure out how to upload and manage images in that new table.