Paperclip :: AdapterRegistry :: NoHandlerError使用krajee bootstrap文件输入时

时间:2016-02-02 22:03:12

标签: ruby-on-rails paperclip

我正在使用krajee bootstrap文件输入来在Rails中上传多个文件。 点击上传按钮后,我得到了Paperclip :: AdapterRegistry :: NoHandlerError。 任何人都可以帮助我。感谢

class WorkFilesController < ApplicationController

def upload
  @wf = WorkFile.new
  @wf.attachment = params[:pm_file_upload]
  @wf.save
end

end

Started POST "/work_files/upload" for 192.168.0.5 at 2016-02-02 21:51:17 +0000
Processing by WorkFilesController#upload as JSON
  Parameters: {"pm_file_upload"=>[#<ActionDispatch::Http::UploadedFile:0x55acb48 @tempfile=#<File:/var/folders/bC/bCJs3dCDGoa9n-zhECDRnU+++TI/-Tmp-/RackMultipart20160202-44332-wpd4ik>, @original_filename="hello world.pdf", @content_type="application/pdf", @headers="Content-Disposition: form-data; name=\"pm_file_upload[]\"; filename=\"hello world.pdf\"\r\nContent-Type: application/pdf\r\n">], "file_id"=>"0"}
Completed 500 Internal Server Error in 10ms

Paperclip::AdapterRegistry::NoHandlerError (No handler found for [#<ActionDispatch::Http::UploadedFile:0x55acb48 @tempfile=#<File:/var/folders/bC/bCJs3dCDGoa9n-zhECDRnU+++TI/-Tmp-/RackMultipart20160202-44332-wpd4ik>, @original_filename="hellow world.pdf", @content_type="application/pdf", @headers="Content-Disposition: form-data; name=\"pm_file_upload[]\"; filename=\"hello world.pdf\"\r\nContent-Type: application/pdf\r\n">]):
  app/controllers/work_files_controller.rb:5:in `upload'
 SELECT CAST(Count(1) as VARCHAR(30)) AS SourceRowCount 
 FROM table 
 where countryid= '" +@[User::Id] +"'"+ " "+"
 AND locationid ="'+@[User::ID1]+'"

1 个答案:

答案 0 :(得分:0)

更改@wf.attachment = params[:pm_file_upload]@wf.attachment = params[:pm_file_upload][0]