aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/action_controller_overview.md
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-03-05 10:56:36 +0100
committerYves Senn <yves.senn@gmail.com>2013-03-05 10:58:39 +0100
commit0e7abf21dd38ab6fb402843afb8ac42ec550d901 (patch)
tree4e7ffb09c9b243c81d7a9941b5ad8b3aa421272b /guides/source/action_controller_overview.md
parentaeb48c3b29c25576241a947722ae8db49ed129e4 (diff)
downloadrails-0e7abf21dd38ab6fb402843afb8ac42ec550d901.tar.gz
rails-0e7abf21dd38ab6fb402843afb8ac42ec550d901.tar.bz2
rails-0e7abf21dd38ab6fb402843afb8ac42ec550d901.zip
example for `accepts_nested_attribtues_for` and strong parameters.
Closes #9558.
Diffstat (limited to 'guides/source/action_controller_overview.md')
-rw-r--r--guides/source/action_controller_overview.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md
index 027f4b785f..61eb2ef089 100644
--- a/guides/source/action_controller_overview.md
+++ b/guides/source/action_controller_overview.md
@@ -281,6 +281,15 @@ root-key because normally it does not exist when calling `new`:
params.fetch(blog:, {}).permit(:title, :author)
```
+`accepts_nested_attributes_for` allows you update and destroy the
+associated records. This is based on the `id` and `_destroy`
+parameters:
+
+```ruby
+# permit :id and :_destroy
+params.require(:author).permit(:name, books_attributes: [:title, :id, :_destroy])
+```
+
#### Outside the Scope of Strong Parameters
The strong parameter API was designed with the most common use cases