I have a very simple controller set up:
class LibrariesController < ApplicationController
...
def create
@user.libraries << Library.new(params)
@user.save
render :json => "success!"
end
...
end
Basically, whenever I try to access the create method of LibrariesController using HTTParty.post I get a WEBrick::HTTPStatus::LengthRequired error on the server. The method is not even being accessed! Here is the stack trace (this is the full output server side - notice that the controller isn't even being accessed):
[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
I'm running rails 2.3.5 and ruby 1.8.7. Any help would be greatly appreciated. Let me know if you need more details.