update getting_started guide to reduce confusion [ci skip] (#37750)

Add a yellow "NOTE" block to see if the guide looks better.
This commit is contained in:
finn 2019-12-08 08:25:49 +08:00 committed by Ryuta Kamizono
parent 97b0833458
commit 9024fa31e2
1 changed files with 11 additions and 2 deletions

View File

@ -1129,8 +1129,9 @@ you attempt to do just that on the new article form
We've covered the "CR" part of CRUD. Now let's focus on the "U" part, updating
articles.
The first step we'll take is adding an `edit` action to the `ArticlesController`,
generally between the `new` and `create` actions, as shown:
The first step we'll take is adding an `edit` action to the
`ArticlesController`, generally between the `new` and `create`
actions, as shown:
```ruby
def new
@ -1152,6 +1153,10 @@ def create
end
```
NOTE: We're using `edit` to render a view. For the actual
saving of the changes to the Article, we'll add an `update` action later.
The view will contain a form similar to the one we used when creating
new articles. Create a file called `app/views/articles/edit.html.erb` and make
it look as follows:
@ -1214,6 +1219,10 @@ Next, we need to create the `update` action in
Add it between the `create` action and the `private` method:
```ruby
def edit
@article = Article.find(params[:id])
end
def create
@article = Article.new(article_params)