Browse files

example for `accepts_nested_attribtues_for` and strong parameters.

Closes #9558.
  • Loading branch information...
1 parent aeb48c3 commit 0e7abf21dd38ab6fb402843afb8ac42ec550d901 @senny senny committed Mar 5, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 guides/source/
@@ -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`
+# 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

0 comments on commit 0e7abf2

Please sign in to comment.