2016-07-25 61 views
0

我使用繭來附加文件。編輯問題時,我需要能夠刪除文件。林停留在得到確切的文件名渲染編輯繭軌道,如何獲得緩存文件名

 div.edit_question 
    =form_for @question, remote: true do |f|  
    = f.label :title, class: 'label_hidden' 
    = f.text_field :title 
    br 
    = f.label :body, class: 'label_hidden' 
    = f.text_area :body 
    br 
    = f.fields_for :attachments do |f|     
     .nested-fields   
     = link_to_remove_association "remove #{ NAME HERE }", f  
    br 
    = f.submit 'Update' 

回答

0

結案))

=form_for @question, remote: true do |f|  
    = f.label :title, class: 'label_hidden' 
    = f.text_field :title 
    br 
    = f.label :body, class: 'label_hidden' 
    = f.text_area :body 
    br 
    - @question.attachments.each do |att| 
    = f.fields_for att do |f|     
     .nested-fields   
     = link_to_remove_association "remove #{ att.file.filename }", f  
    br 
    = f.submit 'Update' 
+0

時,如果這是正確的答案刪除,請把它標記爲正確答案:d –