From 9024fa31e28554d18dc173ae6343884e699fe141 Mon Sep 17 00:00:00 2001 From: finn <10386624+printfinn@users.noreply.github.com> Date: Sun, 8 Dec 2019 08:25:49 +0800 Subject: [PATCH] update getting_started guide to reduce confusion [ci skip] (#37750) Add a yellow "NOTE" block to see if the guide looks better. --- guides/source/getting_started.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index f0712868f8..7116bc67fe 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -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)