如何将多部分添加到表单助手(Carrierwave)

How add multipart to form helper (Carrierwave)

我尝试在我的表单中为 Carrierwave 添加分段上传,但我在一个模型 (post) 中有两个控制器(admin_posts 和 posts)。所以我这样做不明白如何指定这个

_form.html.haml

= form_for [:admin, @post] do |f|
  = f.fields_for :photos do |photo_fields|
    = photo_fields.file_field :image
  = f.text_field :title, class: "form-control", placeholder: "Title"
  = f.text_area :body, rows: 12, class: "form-control", placeholder: "Body"
  .pull-right
    = f.submit "Send", class: "btn btn-success"

怎么解决?

对不起我的英语

试试这个

= form_for [:admin, @post], url: your_action_path(@post), html: { multipart: true } do |f|