aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2006-03-05 19:16:55 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2006-03-05 19:16:55 +0000
commit0635f633ccfdef719e805de20b3b5b385bf72b57 (patch)
tree8ee1664aa17a70d9628108e45f214ecc57dd21a7 /actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
parent03d37a2d68c1940f65d5a65a51ae747955a5b075 (diff)
downloadrails-0635f633ccfdef719e805de20b3b5b385bf72b57.tar.gz
rails-0635f633ccfdef719e805de20b3b5b385bf72b57.tar.bz2
rails-0635f633ccfdef719e805de20b3b5b385bf72b57.zip
ActionController::Base.param_parsers now accept symbols. currently supported are :xml_node, :xml_simple and :yaml
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3778 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/cgi_ext/cgi_methods.rb')
-rwxr-xr-xactionpack/lib/action_controller/cgi_ext/cgi_methods.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
index 89f982f56f..feab806077 100755
--- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
+++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
@@ -59,7 +59,19 @@ class CGIMethods #:nodoc:
end
def self.parse_formatted_request_parameters(format, raw_post_data)
- ActionController::Base.param_parsers[format].call(raw_post_data) || {}
+ params = case strategy = ActionController::Base.param_parsers[format]
+ when Proc
+ strategy.call(raw_post_data)
+ when :xml_node
+ node = XmlNode.from_xml(raw_post_data)
+ { node.node_name => node }
+ when :xml_simple
+ XmlSimple.xml_in(raw_post_data, 'ForceArray' => false)
+ when :yaml
+ YAML.load(raw_post_data)
+ end
+
+ params || {}
rescue Object => e
{ "exception" => "#{e.message} (#{e.class})", "backtrace" => e.backtrace,
"raw_post_data" => raw_post_data, "format" => format }