aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorOscar Del Ben <info@oscardelben.com>2012-05-02 10:42:59 +0200
committerOscar Del Ben <info@oscardelben.com>2012-05-02 11:40:25 +0200
commit47ec49276d40ed565d805069bb2a746e9a7b3157 (patch)
treec248cfffe23a2156f471178a9fb69730e9f9238f /guides/source
parenta411e8828a50795139df6ed210271c1a6cbd135d (diff)
downloadrails-47ec49276d40ed565d805069bb2a746e9a7b3157.tar.gz
rails-47ec49276d40ed565d805069bb2a746e9a7b3157.tar.bz2
rails-47ec49276d40ed565d805069bb2a746e9a7b3157.zip
Rewrite comments action in getting started guide
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/getting_started.textile35
1 files changed, 14 insertions, 21 deletions
diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile
index 44f3b978db..7ad01ae636 100644
--- a/guides/source/getting_started.textile
+++ b/guides/source/getting_started.textile
@@ -1367,60 +1367,53 @@ template. This is where we want the comment to show, so let's add that to the
+app/views/posts/show.html.erb+.
<erb>
-<p id="notice"><%= notice %></p>
-
-<p>
- <b>Name:</b>
- <%= @post.name %>
-</p>
-
<p>
- <b>Title:</b>
+ <strong>Title:</strong>
<%= @post.title %>
</p>
<p>
- <b>Content:</b>
- <%= @post.content %>
+ <strong>Text:</strong>
+ <%= @post.texthttp://beginningruby.org/ %>
</p>
<h2>Comments</h2>
<% @post.comments.each do |comment| %>
<p>
- <b>Commenter:</b>
+ <strong>Commenter:</strong>
<%= comment.commenter %>
</p>
<p>
- <b>Comment:</b>
+ <strong>Comment:</strong>
<%= comment.body %>
</p>
<% end %>
<h2>Add a comment:</h2>
<%= form_for([@post, @post.comments.build]) do |f| %>
- <div class="field">
+ <p>
<%= f.label :commenter %><br />
<%= f.text_field :commenter %>
- </div>
- <div class="field">
+ </p>
+ <p>
<%= f.label :body %><br />
<%= f.text_area :body %>
- </div>
- <div class="actions">
+ </p>
+ <p>
<%= f.submit %>
- </div>
+ </p>
<% end %>
-<br />
-
<%= link_to 'Edit Post', edit_post_path(@post) %> |
-<%= link_to 'Back to Posts', posts_path %> |
+<%= link_to 'Back to Posts', posts_path %>
</erb>
Now you can add posts and comments to your blog and have them show up in the
right places.
+!images/getting_started/post_with_comments.png(Post with Comments)!
+
h3. Refactoring
Now that we have posts and comments working, take a look at the