我试图将函数变量作为符号传递给载波无济于事,我怎么能正确地做到这一点?
像这样:
image_tag @profile.photos.first.file_url(:size)
我的功能:
# 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