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)