ユーザーがLinkedinから取得するか、独自のものをアップロードできるプロフィール写真を作成しています。ユーザーが LinkedIn から取得すると、次のように表示されますimage_tag
。
image_tag(Base64::decode64(field_value), :alt => "profile_pic",:id => "profile_pic")
ただし、ユーザーは画像をアップロードすることもできます。
file_field_tag("profile_pic")
これらのコードは、apply_helper.rb からレンダリングされます。
def render_profile_image(field, alt, title)
if field.nil?
content_tag(:span, title) + tag(:br) + image_tag("user.png", :alt => alt) + tag(:br) + \ file_field_tag("profile_pic") + tag(:br) + content_tag(:small, t("apply.create.labels.profile_pic")) + tag(:br)
else
field_value = field["VALUE"]
content_tag(:span, title) + tag(:br) + image_tag(Base64::decode64(field_value), :alt => "profile_pic",:id => "profile_pic") + tag(:br) + \
file_field_tag("profile_pic") + tag(:br) + content_tag(:small, t("apply.create.labels.profile_pic")) + tag(:br)
end
end
この時点まではこれが明確であることを願っていますが、申請するとすべてがうまく記入されます。
適用コントローラー内:
params["profile_pic"]
からのコンテンツのみを表示し、値を に取得するために表示されないfile_field_tag
のみをレンダリングします。image_tag
apply_controller
アドバイスありがとうございます。