Paperclip's error on a production server (unicorn)

£可爱£侵袭症+ 提交于 2019-12-11 22:17:48

问题


I use paperclip for upload images for post. For images there is a separate model, and posts has has_many relation. For uploading, http://github.com/Valums-File-Uploader/file-uploader is used. On local machine, all work fine (production and development mode).

Production server (ubuntu 12.04) uses unicorn + nginx. And when I'm trying to upload images,I'm getting:

Paperclip::AdapterRegistry::NoHandlerError (No handler found for # 
                                               Unicorn::TeeInput:0x00000005cdd728 
                                               @len=619851, @chunked=false, 
                                               @socket=#<Kgio::Soc$
                                               app/admin/posts.rb:7:in block (2 levels)
                                               in <top (required)>'

回答1:


I helped this answer: https://stackoverflow.com/a/15513492/1530784

I added

if @raw_file.class.name == 'Unicorn::TeeInput'
  @raw_file = Paperclip::StringioAdapter.new(@raw_file)
end

In method parse_raw_upload



来源:https://stackoverflow.com/questions/19359071/paperclips-error-on-a-production-server-unicorn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!