diff options
author | Bart de Water <bart@somnilocode.nl> | 2016-03-12 19:09:07 +0100 |
---|---|---|
committer | Bart de Water <bart@somnilocode.nl> | 2016-03-12 19:10:15 +0100 |
commit | 9a0fc9a7ad6917421b1f79825eaeaed7ad53e094 (patch) | |
tree | a148891e988f6fee0dbeb95ee06e0d80f4187289 /actionpack/lib | |
parent | 9201030320d09bb2ec76a7cc59aa58f77f984995 (diff) | |
download | rails-9a0fc9a7ad6917421b1f79825eaeaed7ad53e094.tar.gz rails-9a0fc9a7ad6917421b1f79825eaeaed7ad53e094.tar.bz2 rails-9a0fc9a7ad6917421b1f79825eaeaed7ad53e094.zip |
Add explanation about accepts_nested_attributes_for keys in the strong parameters documentation [skip ci]
Diffstat (limited to 'actionpack/lib')
-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 # |