ruby on rails - Using Carrierwave to upload image and that works but I don't know how to call the :thumb method -
hello here want do... have method checks if image added or not if not placeholder used.
i make if image uploaded on index page :thumb version of image used , when in show page normal image size used.
i have
image_uploader.rb include carrierwave::rmagick version :thumb 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>
image_tag(article.image) will like
image_tag(article.image.thumb) or image_tag(article.image(:thumb))
both versions work
Comments
Post a Comment