aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/action_view_overview.md
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2017-12-26 13:30:39 +0200
committerbogdanvlviv <bogdanvlviv@gmail.com>2017-12-26 13:30:39 +0200
commit181a9fdafe1fef515db3dbd3d580e55e283afc9a (patch)
treea6b97a4063b2e06ca134ca17a1d70f567641506e /guides/source/action_view_overview.md
parent6783bcab7ab11f2ced4b711d3518422e35e3dc01 (diff)
downloadrails-181a9fdafe1fef515db3dbd3d580e55e283afc9a.tar.gz
rails-181a9fdafe1fef515db3dbd3d580e55e283afc9a.tar.bz2
rails-181a9fdafe1fef515db3dbd3d580e55e283afc9a.zip
Update "Action View Overview" guide [ci skip]
- Provide full / Fix generated HTML by `form_for` in the example. - Provide full params in the example. - Express params[:person] in the sentence.
Diffstat (limited to 'guides/source/action_view_overview.md')
-rw-r--r--guides/source/action_view_overview.md14
1 files changed, 8 insertions, 6 deletions
diff --git a/guides/source/action_view_overview.md b/guides/source/action_view_overview.md
index fde2040173..1cba5c6fb6 100644
--- a/guides/source/action_view_overview.md
+++ b/guides/source/action_view_overview.md
@@ -807,20 +807,22 @@ The core method of this helper, `form_for`, gives you the ability to create a fo
The HTML generated for this would be:
```html
-<form action="/people/create" method="post">
- <input id="person_first_name" name="person[first_name]" type="text" />
- <input id="person_last_name" name="person[last_name]" type="text" />
- <input name="commit" type="submit" value="Create" />
+<form class="new_person" id="new_person" action="/people" accept-charset="UTF-8" method="post">
+ <input name="utf8" type="hidden" value="&#x2713;" />
+ <input type="hidden" name="authenticity_token" value="lTuvBzs7ANygT0NFinXj98tfw3Emfm65wwYLbUvoWsK2pngccIQSUorM2C035M9dZswXgWTvKwFS8W5TVblpYw==" />
+ <input type="text" name="person[first_name]" id="person_first_name" />
+ <input type="text" name="person[last_name]" id="person_last_name" />
+ <input type="submit" name="commit" value="Create" data-disable-with="Create" />
</form>
```
The params object created when this form is submitted would look like:
```ruby
-{ "action" => "create", "controller" => "people", "person" => { "first_name" => "William", "last_name" => "Smith" } }
+{"utf8" => "✓", "authenticity_token" => "lTuvBzs7ANygT0NFinXj98tfw3Emfm65wwYLbUvoWsK2pngccIQSUorM2C035M9dZswXgWTvKwFS8W5TVblpYw==", "person" => {"first_name" => "William", "last_name" => "Smith"}, "commit" => "Create", "controller" => "people", "action" => "create"}
```
-The params hash has a nested person value, which can therefore be accessed with params[:person] in the controller.
+The params hash has a nested person value, which can therefore be accessed with `params[:person]` in the controller.
#### check_box