I have been trying for ages to find out how to send a PUT request to the server using ruby on rails. This page makes no fucking mention of a put() function. I cursed on many occasion.  Here it is. Hope this helps someone.

require ‘net/http’
url  = ‘/api/user.xml?id=6′
post_data = “<user><firstname>Freeman</firstname></user>”
http = Net::HTTP.new(‘www.asdf.com’)
http.read_timeout = 300 # seconds
http.open_timeout = 180 # seconds
resp, data = http.put(url, post_data)


No Comments on “Sending A PUT request to the Server using Ruby on Rails”

You can track this conversation through its atom feed.

No one has commented on this entry yet.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>