diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2016-11-27 23:23:16 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-27 23:23:16 -0300 |
commit | 8b2505347ff020231e82dbdf55b5fadccf109770 (patch) | |
tree | bd4fc139f725e85ca2d059a7c4ad4b3923afc0fb | |
parent | 08251076e37c02357f77f2a99c71e9270ca6920a (diff) | |
parent | fa497ebb0d4b1832ec6234f609bcd986850f9beb (diff) | |
download | rails-8b2505347ff020231e82dbdf55b5fadccf109770.tar.gz rails-8b2505347ff020231e82dbdf55b5fadccf109770.tar.bz2 rails-8b2505347ff020231e82dbdf55b5fadccf109770.zip |
Merge pull request #27190 from jnoortheen/issue-27189
I found this issue and wanted to give the fix.
-rw-r--r-- | guides/source/getting_started.md | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index c04d42d743..6ec5106bb3 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1157,7 +1157,7 @@ it look as follows: ```html+erb <h1>Edit article</h1> -<%= form_for :article, url: article_path(@article), method: :patch do |f| %> +<%= form_for(@article) do |f| %> <% if @article.errors.any? %> <div id="error_explanation"> @@ -1195,14 +1195,15 @@ it look as follows: This time we point the form to the `update` action, which is not defined yet but will be very soon. -The `method: :patch` option tells Rails that we want this form to be submitted +Passing the article object to the method, will automagically create url for submitting the edited article form. +This option tells Rails that we want this form to be submitted via the `PATCH` HTTP method which is the HTTP method you're expected to use to **update** resources according to the REST protocol. The first parameter of `form_for` can be an object, say, `@article` which would cause the helper to fill in the form with the fields of the object. Passing in a symbol (`:article`) with the same name as the instance variable (`@article`) -also automagically leads to the same behavior. This is what is happening here. +also automagically leads to the same behavior. More details can be found in [form_for documentation] (http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for). |