diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2013-05-01 16:24:13 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2013-05-01 16:24:13 +0530 |
commit | 7ead1d81431b2c2c0366347b7bfdf9a329b6f934 (patch) | |
tree | 9a6a18fbb185cf2dfa48016dd32c787fe352752e /guides/source/action_controller_overview.md | |
parent | 78db16d440c610edeb8b2bb37233a5991caf4a29 (diff) | |
parent | 8476932aacbc45ce38b007cca0bb3f12e741f709 (diff) | |
download | rails-7ead1d81431b2c2c0366347b7bfdf9a329b6f934.tar.gz rails-7ead1d81431b2c2c0366347b7bfdf9a329b6f934.tar.bz2 rails-7ead1d81431b2c2c0366347b7bfdf9a329b6f934.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'guides/source/action_controller_overview.md')
-rw-r--r-- | guides/source/action_controller_overview.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index db91425c76..43a59e8d43 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -148,7 +148,7 @@ Also, if you've turned on `config.wrap_parameters` in your initializer or callin And assume that you're sending the data to `CompaniesController`, it would then be wrapped in `:company` key like this: ```ruby -{ :name => "acme", :address => "123 Carrot Street", :company => { :name => "acme", :address => "123 Carrot Street" } } +{ 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) @@ -246,7 +246,7 @@ To declare that the value in `params` must be an array of permitted scalar values map the key to an empty array: ```ruby -params.permit(:id => []) +params.permit(id: []) ``` To whitelist an entire hash of parameters, the `permit!` method can be @@ -266,9 +266,9 @@ mass-assigned. You can also use permit on nested parameters, like: ```ruby -params.permit(:name, {:emails => []}, - :friends => [ :name, - { :family => [ :name ], :hobbies => [] }]) +params.permit(:name, { emails: [] }, + friends: [ :name, + { family: [ :name ], hobbies: [] }]) ``` This declaration whitelists the `name`, `emails` and `friends` |