aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikac.hu>2013-02-19 15:41:03 -0500
committerPrem Sichanugrist <s@sikac.hu>2013-02-20 08:46:44 -0500
commitc9909db9f2f81575ef2ea2ed3b4e8743c8d6f1b9 (patch)
tree2ef8cb5fd3668585da1129f3abb7dcc57e7abb19 /guides
parente1456ad95ef45971ff1593be3d1364ed42bcd9ee (diff)
downloadrails-c9909db9f2f81575ef2ea2ed3b4e8743c8d6f1b9.tar.gz
rails-c9909db9f2f81575ef2ea2ed3b4e8743c8d6f1b9.tar.bz2
rails-c9909db9f2f81575ef2ea2ed3b4e8743c8d6f1b9.zip
Remove XML Parser from ActionDispatch
If you want an ability to parse XML parameters, please install `actionpack-xml_parser` gem.
Diffstat (limited to 'guides')
-rw-r--r--guides/source/action_controller_overview.md8
1 files changed, 5 insertions, 3 deletions
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md
index 7260a48c8c..da155628f3 100644
--- a/guides/source/action_controller_overview.md
+++ b/guides/source/action_controller_overview.md
@@ -116,9 +116,9 @@ When this form is submitted, the value of `params[:client]` will be `{"name" =>
Note that the `params` hash is actually an instance of `ActiveSupport::HashWithIndifferentAccess`, which acts like a hash that lets you use symbols and strings interchangeably as keys.
-### JSON/XML parameters
+### JSON parameters
-If you're writing a web service application, you might find yourself more comfortable on accepting parameters in JSON or XML format. Rails will automatically convert your parameters into `params` hash, which you'll be able to access like you would normally do with form data.
+If you're writing a web service application, you might find yourself more comfortable on accepting parameters in JSON format. Rails will automatically convert your parameters into `params` hash, which you'll be able to access like you would normally do with form data.
So for example, if you are sending this JSON parameter:
@@ -128,7 +128,7 @@ So for example, if you are sending this JSON parameter:
You'll get `params[:company]` as `{ :name => "acme", "address" => "123 Carrot Street" }`.
-Also, if you've turned on `config.wrap_parameters` in your initializer or calling `wrap_parameters` in your controller, you can safely omit the root element in the JSON/XML parameter. The parameters will be cloned and wrapped in the key according to your controller's name by default. So the above parameter can be written as:
+Also, if you've turned on `config.wrap_parameters` in your initializer or calling `wrap_parameters` in your controller, you can safely omit the root element in the JSON parameter. The parameters will be cloned and wrapped in the key according to your controller's name by default. So the above parameter can be written as:
```json
{ "name": "acme", "address": "123 Carrot Street" }
@@ -142,6 +142,8 @@ And assume that you're sending the data to `CompaniesController`, it would then
You can customize the name of the key or specific parameters you want to wrap by consulting the [API documentation](http://api.rubyonrails.org/classes/ActionController/ParamsWrapper.html)
+NOTE: A support for parsing XML parameters has been extracted into a gem named `actionpack-xml_parser`
+
### Routing Parameters
The `params` hash will always contain the `:controller` and `:action` keys, but you should use the methods `controller_name` and `action_name` instead to access these values. Any other parameters defined by the routing, such as `:id` will also be available. As an example, consider a listing of clients where the list can show either active or inactive clients. We can add a route which captures the `:status` parameter in a "pretty" URL: