生产服务器上的 Paperclip 错误(独角兽) [英] Paperclip's error on a production server (unicorn)
本文介绍了生产服务器上的 Paperclip 错误(独角兽)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用回形针上传图片以供发布.对于图像,有一个单独的模型,posts 有 has_many 关系.对于上传,http://github.com/Valums-File-Uploader/file-uploader 被使用.在本地机器上,一切正常(生产和开发模式).
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).
生产服务器(ubuntu 12.04)使用unicorn + nginx.当我尝试上传图片时,我得到:
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)>'
推荐答案
我帮了这个答案:https://stackoverflow.com/a/15513492/1530784
我添加了
if @raw_file.class.name == 'Unicorn::TeeInput'
@raw_file = Paperclip::StringioAdapter.new(@raw_file)
end
在方法parse_raw_upload
这篇关于生产服务器上的 Paperclip 错误(独角兽)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文