aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/getting_started.textile
diff options
context:
space:
mode:
authorRyan Bigg <radarlistener@gmail.com>2012-05-16 18:01:50 +1000
committerRyan Bigg <radarlistener@gmail.com>2012-05-16 18:05:36 +1000
commitf76e0a5484c7d4ee202c479309f3da6992ddf4bd (patch)
treed5d1bb65f253d481dffcf1026bb382590c5bc6a0 /guides/source/getting_started.textile
parent9c76aa0cc57aacb9f719bfb8aaeac5b7ad1711a5 (diff)
downloadrails-f76e0a5484c7d4ee202c479309f3da6992ddf4bd.tar.gz
rails-f76e0a5484c7d4ee202c479309f3da6992ddf4bd.tar.bz2
rails-f76e0a5484c7d4ee202c479309f3da6992ddf4bd.zip
[getting started] split up adding link for edit to index and show templates
Diffstat (limited to 'guides/source/getting_started.textile')
-rw-r--r--guides/source/getting_started.textile13
1 files 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:
<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>