Im trying to make 1 global function to display carrier wave images in different sizes. the problem is passing the size var in method call to the carrierwave helper like below:
def get_avatar(id, size)
@profile = User.find(id).profile rescue nil
image_tag @profile.photos.first.file_url(:img_120x145)
rescue
image_tag ("/assets/avatars/img_#{size}.png")
end
I tried all kinds of things but are unable to pass the size var to the @profile.photos.first_url(size here).
How should one approach this?
Heres what worked for me recently.
<% image_tag @profile.photos.first.url(size) %>