diff --git a/README.md b/README.md index 8b7b582..589eddb 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,29 @@ This will mark the `:log_entry` parameters hash and any subhash of it permitted. 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` attributes. It is expected that `emails` will be an array of permitted scalar values and that `friends` will be an array of resources with specific attributes : they should have a `name` attribute (any permitted scalar values allowed), a `hobbies` attribute as an array of permitted scalar values, and a `family` attribute which is restricted to having a `name` (any permitted scalar values allowed, too). +**Here is what this does** + +* It whitelists the `name`, `emails` and `friends` attributes. +* It is expected that `emails` will be an array of permitted scalar values. +* It is expected that `friends` will be an array of resources with specific attributes: + * a `name` attribute (any permitted scalar values allowed) + * a `hobbies` attribute as an array of permitted scalar values + * a `family` attribute which is restricted to having a `name` (any permitted scalar values allowed, too). Thanks to Nick Kallen for the permit idea!