Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

sync example and documentation for strong_parameters hash whitelisting.

[ci skip]

This is a follow up to #12609 and integrates #12158.

Thanks @aspiers.
Closes #12158.

  • Loading branch information...
commit 7135c4a614f9413b2d47bfe920df2248cdfb6f77 1 parent 21b8806
@senny senny authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 guides/source/
10 guides/source/
@@ -321,10 +321,12 @@ in mind. It is not meant as a silver bullet to handle all your
whitelisting problems. However you can easily mix the API with your
own code to adapt to your situation.
-Imagine a scenario where you want to whitelist an attribute
-containing a hash with any keys. Using strong parameters you can't
-allow a hash with any keys but you can use a simple assignment to get
-the job done:
+Imagine a scenario where you have parameters representing a product
+name and a hash of arbitrary data associated with that product, and
+you want to whitelist the product name attribute but also the whole
+data hash. The strong parameters API doesn't let you directly
+whitelist the whole of a nested hash with any keys, but you can use
+the keys of your nested hash to declare what to whitelist:
def product_params
Please sign in to comment.
Something went wrong with that request. Please try again.