如何添加multipart以形成帮助器(Carrierwave)

时间:2015-01-21 11:35:54

标签: ruby-on-rails multipart

我尝试在我的表单中为Carrierwave添加分段上传,但我在一个模型中有两个控制器(admin_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"

如何解决?

抱歉我的英文

1 个答案:

答案 0 :(得分:0)

试试这个

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