創建方法時,我有一個非常簡單的控制器設置:的WEBrick :: ::的HTTPStatus錯誤LengthRequired在訪問控制器
class LibrariesController < ApplicationController
...
def create
@user.libraries << Library.new(params)
@user.save
render :json => "success!"
end
...
end
基本上,只要我試圖訪問使用LibrariesController的創建方法HTTParty.post我在服務器上得到一個WEBrick :: HTTPStatus :: LengthRequired錯誤。該方法甚至沒有被訪問!這裏是堆棧跟蹤(這是完整的輸出服務器端 - 請注意,控制器甚至沒有被訪問):
[2010-04-16 00:35:39] ERROR WEBrick::HTTPStatus::LengthRequired
[2010-04-16 00:35:39] ERROR HTTPRequest#fixup: WEBrick::HTTPStatus::LengthRequired occured.
[2010-04-16 00:35:39] ERROR NoMethodError: private method `gsub!' called for #<Class:0x2362160>
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/htmlutils.rb:17:in `escape'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/httpresponse.rb:232:in `set_error'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:70:in `run'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/webrick.rb:14:in `run'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
我運行軌道2.3.5和1.8.7的紅寶石。任何幫助將不勝感激。讓我知道你是否需要更多細節。
這是事實 - 然而,這條消息是在2008年編寫的,它也表示這個錯誤是「低優先級」。我不知道如果我已經配置了一些錯誤...... 當我與雜種狗跑,我得到以下錯誤: 的ActionController :: InvalidAuthenticityToken(ActionController的:: InvalidAuthenticityToken): 渲染救援/ _trace(178.6ms) 渲染救援/ _request_and_response(1.5ms) 渲染救援/佈局(unprocessable_entity) hmmmmmm ... – 2010-04-16 17:10:31
是的,你是對的克里斯,但這是唯一可能的錯誤解釋。然而,Mongrel錯誤並不那麼神祕,最近我看到一個類似的問題,那時我正在開會。你的會議商店是什麼?你有會話密鑰和祕密設置? – konung 2010-04-16 21:07:30
切換到雜種對我來說確實有效:) – 2011-09-25 03:11:10