上传图片时,一切正常。但在编辑时,它不显示文件字段值。只是一个空的 file_field,就像什么都没有。图片标题正确显示。其他文字为匈牙利语。
_form.html.haml
= simple_nested_form_for(@post) do |f|
= f.input :title, label: 'Cím'
= f.input :body, label: "Test"
= f.fields_for :pics do |pic_form|
= pic_form.text_field :title
%br/
= pic_form.file_field :image
= pic_form.link_to_remove "Kép Törlése", class: "btn btn-warning"
%br/
%br/
%p= f.link_to_add "Kép hozzáadása", :pics, class: "btn btn-success"
%br/
%br/
= f.submit "Mentés", class: "btn btn-primary"
= javascript_include_tag :defaults, "nested_form"
如何将现有文件传递给file_field?