Permalink
Browse files

[getting started] split up adding link for edit to index and show tem…

…plates
  • Loading branch information...
1 parent 9c76aa0 commit f76e0a5484c7d4ee202c479309f3da6992ddf4bd @radar radar committed May 16, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 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:
<erb>
-# app/view/posts/index.html.erb
<table>
<tr>
@@ -895,11 +895,16 @@ Finally, we want to show a link to the +edit+ action in the +index+ and
</tr>
<% end %>
</table>
+</erb>
-# 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:
+<erb>
...
+
<%= link_to 'Back', :action => :index %>
| <%= link_to 'Edit', :action => :edit, :id => @post.id %>
</erb>

0 comments on commit f76e0a5

Please sign in to comment.