I'm attempting to use Ramaze, the ruby framework, to implement a RESTful controller. I can't seem to gain access to the data in the request when I send a PUT, however. Sample code:
require 'ramaze'
class PutController < Ramaze::Controller
map '/'
def index
"Argument of "+request[:id]
end
end
Ramaze.start
And my interacting with it via curl:
% curl -d id=5 "http://localhost:7000/"
Argument of 5
% curl -v -X PUT -d id=5 "http://localhost:7000/" > /dev/null
...
HTTP/1.1 500 Internal Server Error
[With a backtrace revealing that the request object is nil]
Am I doing something wrong? How am I supposed to be getting at the body of the PUT request in Ramaze?
try this:
require 'rubygems'
require 'ramaze'
class PutController < Ramaze::Controller
map '/'
def index
"Argument of "+request.POST['id']
end
end
Ramaze.start
it works for PUT as well as POST and GET.