Im trying to pass a function variable to carrier wave as a symbol to no avail, how could I do this correctly?
Like so:
image_tag @profile.photos.first.file_url(:size)
My function:
# Get avatar in correct size
# Display or return default image
def get_avatar(id, size)
this_size = size.to_sym
@profile = User.find(id).profile rescue nil
image_tag @profile.photos.first.file_url(this_size)
rescue
image_tag ("/assets/avatars/img_#{size}.png")
end
If the size is not a string, you will need to convert first.
Try this:
Or skip that line altogether and use this: