diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2016-03-12 19:03:25 +0000 |
---|---|---|
committer | Andrew White <pixeltrix@users.noreply.github.com> | 2016-03-12 19:03:25 +0000 |
commit | 4928c5c719c26e5400e686623a8f748ec7445540 (patch) | |
tree | d1f85419eaa7cadbf58d8405d6d27b5c7e024eb2 /actionpack | |
parent | 6039715130f3592040d5291e49001f93b0ee45e6 (diff) | |
parent | 9a0fc9a7ad6917421b1f79825eaeaed7ad53e094 (diff) | |
download | rails-4928c5c719c26e5400e686623a8f748ec7445540.tar.gz rails-4928c5c719c26e5400e686623a8f748ec7445540.tar.bz2 rails-4928c5c719c26e5400e686623a8f748ec7445540.zip |
Merge pull request #24171 from bdewater/strong_parameters_anaf_doc
Add explanation about accepts_nested_attributes_for keys in the strong parameters docs
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index bfd3375229..76e3b4d25a 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -814,7 +814,8 @@ module ActionController # end # # In order to use <tt>accepts_nested_attributes_for</tt> with Strong \Parameters, you - # will need to specify which nested attributes should be whitelisted. + # will need to specify which nested attributes should be whitelisted. You might want + # to allow +:id+ and +:_destroy+, see ActiveRecord::NestedAttributes for more information. # # class Person # has_many :pets @@ -834,7 +835,7 @@ module ActionController # # It's mandatory to specify the nested attributes that should be whitelisted. # # If you use `permit` with just the key that points to the nested attributes hash, # # it will return an empty hash. - # params.require(:person).permit(:name, :age, pets_attributes: [ :name, :category ]) + # params.require(:person).permit(:name, :age, pets_attributes: [ :id, :name, :category ]) # end # end # |