Skip to content
Browse files

minor corrections

  • Loading branch information...
1 parent 4ef4d57 commit 159e605d1935671d9997bb717dd508dcbf53b506 @vijaydev vijaydev committed May 14, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 railties/guides/source/action_controller_overview.textile
View
10 railties/guides/source/action_controller_overview.textile
@@ -112,15 +112,15 @@ Note that the +params+ hash is actually an instance of +HashWithIndifferentAcces
h4. JSON/XML 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 it 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 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.
-So for example, if you sending this JSON parameter:
+So for example, if you are sending this JSON parameter:
<pre>
-{ "company": { "name": "acme", "address": "123 Carrot Street" }}
+{ "company": { "name": "acme", "address": "123 Carrot Street" } }
</pre>
-You'll get +params[:company]+ as +{ :name => "acme", "address" => "123 Carrot Street" }+.
+You'll get <tt>params[:company]</tt> as <tt>{ :name => "acme", "address" => "123 Carrot Street" }</tt>.
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:
@@ -134,7 +134,7 @@ And assume that you're sending the data to +CompaniesController+, it would then
{ :name => "acme", :address => "123 Carrot Street", :company => { :name => "acme", :address => "123 Carrot Street" }}
</ruby>
-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"
+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
h4. Routing Parameters

0 comments on commit 159e605

Please sign in to comment.
Something went wrong with that request. Please try again.