提交简单的多部分表单时,服务器崩溃并显示"内部服务器错误"。 我已将表格缩小到最小值:
<%= form_for @media_object, :html => {:multipart => true} do |f| %>
<%= f.file_field :media_object_image %>
<%= f.submit "Create!" %>
<% end %>
日志跟踪:
ERROR ArgumentError: unexpected prefix: {"RackMultipart"=>nil, ""=>nil} /Users/christer/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tmpdir.rb:111:in `make_tmpname' /Users/christer/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tmpdir.rb:129:in `create' /Users/christer/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tempfile.rb:132:in `initialize' /Users/christer/.rvm/gems/ruby-2.3.0@teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:22:in `new' /Users/christer/.rvm/gems/ruby-2.3.0@teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:22:in `block in create' /Users/christer/.rvm/gems/ruby-2.3.0@teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:135:in `get_current_head_and_filename_and_content_type_and_name_and_body' /Users/christer/.rvm/gems/ruby-2.3.0@teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:59:in `block in parse' /Users/christer/.rvm/gems/ruby-2.3.0@teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:56:in `loop' /Users/christer/.rvm/gems/ruby-2.3.0@teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:56:in `parse' /Users/christer/.rvm/gems/ruby-2.3.0@teamhubs4/gems/rack-1.6.4/lib/rack/multipart.rb:25:in `parse_multipart' /Users/christer/.rvm/gems/ruby-2.3.0@teamhubs4/gems/rack-1.6.4/lib/rack/request.rb:375:in `parse_multipart' /Users/christer/.rvm/gems/ruby-2.3.0@teamhubs4/gems/rack-1.6.4/lib/rack/request.rb:207:in `POST'
由于最大数量的打开多部分文件,谷歌搜索引发了Rails 4.2的多部分提交问题,但这肯定是不同的。
我使用Ruby 2.3运行Rails 4.2.6。
答案 0 :(得分:0)
虽然我没有使用imgur gem,但Phil Ross让我走上正轨。我确实用to_hash方法扩展了Array类。删除这些扩展,瞧!,事情可以正常工作。
答案 1 :(得分:0)
imgur
并非孤军奋战。 known {{3}}也是{{3}}的原因。检查你的Gemfile。