diff options
author | Jamis Buck <jamis@37signals.com> | 2006-03-25 18:44:28 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2006-03-25 18:44:28 +0000 |
commit | 7bcf4c66591d2108277e3c585fdd2eeca00348d9 (patch) | |
tree | 02c9ac7187f469f64e33ce0990d401658e96e8eb /actionpack/lib/action_controller | |
parent | ef1297d896f6ee12b8d6d31d44d2a45f61f1a667 (diff) | |
download | rails-7bcf4c66591d2108277e3c585fdd2eeca00348d9.tar.gz rails-7bcf4c66591d2108277e3c585fdd2eeca00348d9.tar.bz2 rails-7bcf4c66591d2108277e3c585fdd2eeca00348d9.zip |
Enable application/x-yaml processing by default
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4024 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 52bddac092..daa3c44ade 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -265,9 +265,11 @@ module ActionController #:nodoc: # The param_parsers hash lets you register handlers wich will process the http body and add parameters to the # @params hash. These handlers are invoked for post and put requests. # - # By default application/xml is enabled. A XmlSimple class with the same param name as the root - # will be instanciated in the @params. This allows XML requests to mask themselves as regular form submissions, - # so you can have one action serve both regular forms and web service requests. + # By default application/xml and application/x-yaml are enabled. For application/xml, a XmlSimple class with + # the same param name as the root will be instanciated in the @params. This allows XML requests to mask themselves + # as regular form submissions, so you can have one action serve both regular forms and web service requests. For + # application/x-yaml, the YAML document is merged into the parameters and appears to the application as if the + # YAML elements were simply form submissions. # # Example of doing your own parser for a custom content type: # @@ -279,12 +281,11 @@ module ActionController #:nodoc: # Note: Up until release 1.1 of Rails, Action Controller would default to using XmlSimple configured to discard the # root node for such requests. The new default is to keep the root, such that "<r><name>David</name></r>" results # in params[:r][:name] for "David" instead of params[:name]. To get the old behavior, you can - # re-register XmlSimple as application/xml handler and enable application/x-yaml like this: + # re-register XmlSimple as application/xml handler ike this: # # ActionController::Base.param_parsers[Mime::XML] = # Proc.new { |data| XmlSimple.xml_in(data, 'ForceArray' => false) } - # ActionController::Base.param_parsers[Mime::YAML] = :yaml - @@param_parsers = { Mime::XML => :xml_simple } + @@param_parsers = { Mime::XML => :xml_simple, Mime::YAML => :yaml } cattr_accessor :param_parsers # Template root determines the base from which template references will be made. So a call to render("test/template") |