Skip to content
Browse files

Update README.rdoc

A more specific/detailled example for nested parameters showcasing the extra edge-case of allowing for deep nesting of an array of permitted scalar values.
  • Loading branch information...
1 parent 9f0c7c4 commit 6cb2ed437d0f7ecd4a5ce3714774f8936727724d @chikamichi chikamichi committed
Showing with 3 additions and 1 deletion.
  1. +3 −1 README.rdoc
View
4 README.rdoc
@@ -47,7 +47,9 @@ To declare that the value in +params+ must be an array of permitted scalar value
You can also use permit on nested parameters, like:
- params.permit(:name, {:emails => []}, :friends => [ :name, { :family => [ :name ] }])
+ params.permit(:name, {:emails => []}, :friends => [ :name, { :hobbies => [] }])
+
+This declaration whitelist name, emails and friends attributes, expecting emails to be an array of permitted scalar values and friends to be an array of resources, each with name and hobbies attributes, the latter being an array of permitted scalar values.
Thanks to Nick Kallen for the permit idea!

0 comments on commit 6cb2ed4

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