From 159e605d1935671d9997bb717dd508dcbf53b506 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 14 May 2011 00:51:54 +0530 Subject: minor corrections --- railties/guides/source/action_controller_overview.textile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/railties/guides/source/action_controller_overview.textile b/railties/guides/source/action_controller_overview.textile index 2306165f2d..891bae3d5e 100644 --- a/railties/guides/source/action_controller_overview.textile +++ b/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:
-{ "company": { "name": "acme", "address": "123 Carrot Street" }}
+{ "company": { "name": "acme", "address": "123 Carrot Street" } }
 
-You'll get +params[:company]+ as +{ :name => "acme", "address" => "123 Carrot Street" }+. +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: @@ -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" }} -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 -- cgit v1.2.3