From 323d2c42c3782db9e30b37abb4787fe73d6d7c8d Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Wed, 2 May 2012 11:13:20 +0200 Subject: Rewrite refactoring section in getting started guide --- .../getting_started/app/views/posts/show.html.erb | 26 ++-------------------- 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'guides/code/getting_started/app/views/posts') diff --git a/guides/code/getting_started/app/views/posts/show.html.erb b/guides/code/getting_started/app/views/posts/show.html.erb index 7066c85065..65809033ed 100644 --- a/guides/code/getting_started/app/views/posts/show.html.erb +++ b/guides/code/getting_started/app/views/posts/show.html.erb @@ -9,32 +9,10 @@

Comments

-<% @post.comments.each do |comment| %> -

- Commenter: - <%= comment.commenter %> -

- -

- Comment: - <%= comment.body %> -

-<% end %> +<%= render @post.comments %>

Add a comment:

-<%= form_for([@post, @post.comments.build]) do |f| %> -

- <%= f.label :commenter %>
- <%= f.text_field :commenter %> -

-

- <%= f.label :body %>
- <%= f.text_area :body %> -

-

- <%= f.submit %> -

-<% end %> +<%= render "comments/form" %> <%= link_to 'Edit Post', edit_post_path(@post) %> | <%= link_to 'Back to Posts', posts_path %> -- cgit v1.2.3