This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge pull request #146 from josephers/patch-1

Document how to require multiple keys in params
  • Loading branch information...
2 parents d6727b5 + a31a852 commit 708d7c46e0943474b7860817f70048ce45fd8e63 @dhh dhh committed May 23, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 README.md
View
@@ -70,6 +70,15 @@ This declaration whitelists the `name`, `emails` and `friends` attributes. It is
Thanks to Nick Kallen for the permit idea!
+## Require Multiple Parameters
+
+If you want to make sure that multiple keys are present in a params hash, you can call the method twice:
+
+``` ruby
+params.require(:token)
+params.require(:post).permit(:title)
+```
+
## Handling of Unpermitted Keys
By default parameter keys that are not explicitly permitted will be logged in the development and test environment. In other environments these parameters will simply be filtered out and ignored.

0 comments on commit 708d7c4

Please sign in to comment.