Delete Action:
delete '/:model/:id.json' do
string = Inflector.camelize("#{params[:model]}")
model = Inflector.constantize(string)
record = model.get(params[:id])
record.destroy
puts model.all.to_json
end
Returned Json from model.all.to_json call:
[{"updated_at":"2009\/01\/03 22:56:57 +0000","_id":"00532e4a87c4905619e4ffcf67ad7ec5","_rev":"2257233519","content":"Brand New Note","ruby_class":"Note","user_id":"","model":"note","created_at":"2009\/01\/03 22:56:57 +0000"},{"updated_at":"2009\/01\/03 23:28:14 +0000","_id":"495f37f4575456c6309d0c994346ddd0","_rev":"2334215029","content":"Renamed Note Again!","ruby_class":"Note","user_id":"8ef750face40cf09cc9d92820452a189","model":"note","created_at":"2009\/01\/03 22:56:44 +0000"}]
Request to the delete action showing 200 ok:
127.0.0.1 - - [04/Jan/2009 10:23:56] "POST /note/275baa9fe4dce4c3fd2df4a2274314de.json HTTP/1.1" 200 - 0.4088