diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-05-14 00:51:54 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-05-14 00:51:54 +0530 |
commit | 159e605d1935671d9997bb717dd508dcbf53b506 (patch) | |
tree | 6142ed6b3a371e555fad861585cd15d97accfab4 /railties/guides/source | |
parent | 4ef4d5771950e31de43b8b8ae0389f2807f149bd (diff) | |
download | rails-159e605d1935671d9997bb717dd508dcbf53b506.tar.gz rails-159e605d1935671d9997bb717dd508dcbf53b506.tar.bz2 rails-159e605d1935671d9997bb717dd508dcbf53b506.zip |
minor corrections
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/action_controller_overview.textile | 10 |
1 files 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: <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 |