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 --- guides/source/getting_started.textile | 65 ++++++++++++----------------------- 1 file changed, 22 insertions(+), 43 deletions(-) (limited to 'guides/source') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 7ad01ae636..8ea7c5ab6e 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -1428,12 +1428,12 @@ following into it:

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

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

@@ -1442,21 +1442,14 @@ Then you can change +app/views/posts/show.html.erb+ to look like the following: -

<%= notice %>

- -

- Name: - <%= @post.name %> -

-

- Title: + Title: <%= @post.title %>

- Content: - <%= @post.content %> + Text: + <%= @post.texthttp://beginningruby.org/ %>

Comments

@@ -1464,23 +1457,21 @@ following:

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 %> -
- <%= link_to 'Edit Post', edit_post_path(@post) %> | -<%= link_to 'Back to Posts', posts_path %> | +<%= link_to 'Back to Posts', posts_path %>
This will now render the partial in +app/views/comments/_comment.html.erb+ once @@ -1496,50 +1487,38 @@ create a file +app/views/comments/_form.html.erb+ containing: <%= 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 %>
Then you make the +app/views/posts/show.html.erb+ look like the following: -

<%= notice %>

- -

- Name: - <%= @post.name %> -

-

- Title: + Title: <%= @post.title %>

- Content: - <%= @post.content %> + Text: + <%= @post.texthttp://beginningruby.org/ %>

-

Comments

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

Add a comment:

<%= render "comments/form" %> -
- <%= link_to 'Edit Post', edit_post_path(@post) %> | -<%= link_to 'Back to Posts', posts_path %> | +<%= link_to 'Back to Posts', posts_path %>
The second render just defines the partial template we want to render, -- cgit v1.2.3