问题
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