Created
January 22, 2010 16:38
-
-
Save perplexes/283894 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/sinatras-hat/actions.rb b/lib/sinatras-hat/actions.rb | |
index 9424a10..24f9c1b 100644 | |
--- a/lib/sinatras-hat/actions.rb | |
+++ b/lib/sinatras-hat/actions.rb | |
@@ -21,6 +21,9 @@ module Sinatra | |
end | |
map.action :update, '/:id', :verb => :put do |request| | |
+ if request.env["rack.input"].size > 0 | |
+ request.params.merge!(Hash.from_xml(request.env["rack.input"].read)) | |
+ end | |
record = model.update(request.params) || request.not_found | |
result = record.save ? :success : :failure | |
responder.send(result, :update, request, record) | |
@@ -38,6 +41,9 @@ module Sinatra | |
end | |
map.action :create, '/', :verb => :post do |request| | |
+ if request.env["rack.input"].size > 0 | |
+ request.params.merge!(Hash.from_xml(request.env["rack.input"].read)) | |
+ end | |
record = model.new(request.params) | |
result = record.save ? :success : :failure | |
responder.send(result, :create, request, record) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment