Reputation: 583
hello here is what I want to do... I have a method that checks if the image is added or not if not the placeholder is used.
I would like to make it where if the image is uploaded on the index page the :thumb version of the image is used and when in the show page the normal image size is used.
I have
image_uploader.rb
include CarrierWave::RMagick
version :thumb do
process :scale => [335, 182]
end
articles_helper
def image_for(article)
if article.image.blank?
image_tag('placeholder.jpg')
else
image_tag(article.image)
end
end
index.html.erb
<p>
<%= link_to image_for(article), article %>
</p>
Upvotes: 0
Views: 101
Reputation: 2289
image_tag(article.image)
will be like
image_tag(article.image.thumb)
or image_tag(article.image(:thumb))
both versions are work
Upvotes: 1