1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix form_for guide binding a form to an object.

The HTML generated using
    url: { action: :create}
will not generate the form action "/articles/create", it should generate
the form action "/articles" for a new object.
This commit is contained in:
Derek Reeve 2015-01-13 10:19:59 -08:00
parent 3f14d6a727
commit b5c1bbbee0

View file

@ -275,7 +275,7 @@ There are a few things to note here:
The resulting HTML is:
```html
<form accept-charset="UTF-8" action="/articles/create" method="post" class="nifty_form">
<form accept-charset="UTF-8" action="/articles" method="post" class="nifty_form">
<input id="article_title" name="article[title]" type="text" />
<textarea id="article_body" name="article[body]" cols="60" rows="12"></textarea>
<input name="commit" type="submit" value="Create" />
@ -300,7 +300,7 @@ You can create a similar binding without actually creating `<form>` tags with th
which produces the following output:
```html
<form accept-charset="UTF-8" action="/people/create" class="new_person" id="new_person" method="post">
<form accept-charset="UTF-8" action="/people" class="new_person" id="new_person" method="post">
<input id="person_name" name="person[name]" type="text" />
<input id="contact_detail_phone_number" name="contact_detail[phone_number]" type="text" />
</form>