0

ユーザーが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_tagapply_controller

アドバイスありがとうございます。

4

2 に答える 2

0

2 つの異なるフィールドに同じ名前を使用すると、それらは両方ともparams配列内で同じ名前になります。そのため、両方のフィールドに別の名前を使用することをお勧めします。たとえばprofile_pic、 とprofile_pic_file_info.

于 2013-05-21T07:34:22.653 に答える
0

hidden_​​field_tag を使用してこれを解決しました。

 hidden_field_tag('linkedin_pic',"example.url.com")
于 2013-05-24T08:06:07.107 に答える