【问题标题】:Paperclip's error on a production server (unicorn)生产服务器上的回形针错误(独角兽)
【发布时间】:2013-10-14 11:22:45
【问题描述】:

我使用回形针上传图片以进行发布。对于图像有一个单独的模型,并且帖子有 has_many 关系。 对于上传,使用http://github.com/Valums-File-Uploader/file-uploader。 在本地机器上,一切正常(生产和开发模式)。

生产服务器(ubuntu 12.04)使用 unicorn + nginx。当我尝试上传图片时,我得到:

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)>'

【问题讨论】:

    标签: ruby-on-rails ruby nginx paperclip unicorn


    【解决方案1】:

    我帮助了这个答案:https://stackoverflow.com/a/15513492/1530784

    我加了

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

    在方法parse_raw_upload

    【讨论】:

      猜你喜欢
      • 2011-07-20
      • 2012-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-27
      • 2013-02-20
      • 2011-08-08
      • 1970-01-01
      相关资源
      最近更新 更多