ActiveAdmin + CarrierWave & Multiple Uploads:没有将 nil 隐式转换为 String

ActiveAdmin + CarrierWave & Multiple Uploads: no implicit conversion of nil into String

美好的一天。

我正在使用 ActiveAdmin 和 Carrierwave 将多个上传添加到我的 rails 5 应用程序。

截至目前,我收到以下错误:

no implicit conversion of nil into String

def workfile_path(for_file=original_filename)
   File.join(CarrierWave.tmp_path, @cache_id, version_name.to_s, for_file)
end

这是我设置文件的方式。

# admin/photo.rb  
permit_params :description, {image: []}, :taken, :image_cache, :tag_list, :title

form html: { multipart: true } do |f|
 f.inputs "New Image" do
   f.input :title, placeholder: "Drinking Coffee", hint: "Reference title for photo.", required: true
   f.input :image, as: :file, id: "preview_this_image",
                            input_html: {
                              multiple: true,
                            }
   f.input :taken, label: "Taken on:", as: :date_select, hint: "When was the photo taken?"
 end
 f.actions
end

#schema
create_table "photos", force: :cascade do |t|
  t.string   "description"
  t.datetime "taken"
  t.datetime "created_at",  null: false
  t.datetime "updated_at",  null: false
  t.string   "title"
  t.json     "image"
end

你能帮我理解我做错了什么吗?

文档中有一个容易遗漏的 's'。检查模型中的安装。对于多个文件,您需要mount_uploaders(多个)而不是mount_uploader(单个)。