From f76e0a5484c7d4ee202c479309f3da6992ddf4bd Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Wed, 16 May 2012 18:01:50 +1000 Subject: [getting started] split up adding link for edit to index and show templates --- guides/source/getting_started.textile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 41dd499717..8a0ade1488 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -872,11 +872,11 @@ example, if you'd call +@post.update_attributes(:title => 'A new title')+ Rails would only update the +title+ attribute, leaving all other attributes untouched. -Finally, we want to show a link to the +edit+ action in the +index+ and -+show+ views: +Finally, we want to show a link to the +edit+ action in the list of all the +posts, so let's add that now to +app/views/posts/index.html.erb+ to make it +appear next to the "Show" link: -# app/view/posts/index.html.erb @@ -895,11 +895,16 @@ Finally, we want to show a link to the +edit+ action in the +index+ and <% end %>
+
-# app/view/posts/show.html.erb +And we'll also add one to the +app/views/posts/show.html.erb+ template as well, +so that there's also an "Edit" link on a post's page. Add this at the bottom of +the template: + ... + <%= link_to 'Back', :action => :index %> | <%= link_to 'Edit', :action => :edit, :id => @post.id %> -- cgit v1.2.3