Skip to content

Commit

Permalink
Put the comment form in its own directory. See #339
Browse files Browse the repository at this point in the history
  • Loading branch information
kytrinyx committed Dec 1, 2012
1 parent c99cf9b commit e2d2b26
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source/projects/blogger.markdown
Expand Up @@ -1091,10 +1091,10 @@ But, in reality, we expect to enter the comment directly on the article page. Le
Just above the "Back to Articles List" in the articles `show.html.erb`:

```erb
<%= render partial: 'comment_form' %>
<%= render partial: 'comments/form' %>
```

This is expecting a file `app/views/articles/_comment_form.html.erb`, so create that and add this starter content:
This is expecting a file `app/views/comments/_form.html.erb`, so create the `app/views/comments/` directory with the `_form.html.erb` file, and add this starter content:

```erb
<h3>Post a Comment</h3>
Expand Down Expand Up @@ -1123,7 +1123,7 @@ of the `Article`. Why do you think we use `Comment.new` instead of

#### Improving the Comment Form

Now we can create a form inside our `_comment_form.html.erb` partial like this:
Now we can create a form inside our `comments/_form.html.erb` partial like this:

```erb
<h3>Post a Comment</h3>
Expand Down Expand Up @@ -1157,7 +1157,7 @@ Save and refresh your web browser and you'll get an error like this:

```plain
NoMethodError in Articles#show
Showing app/views/articles/_comment_form.html.erb where line #3 raised:
Showing app/views/comments/_form.html.erb where line #3 raised:
undefined method `comments_path' for #<ActionView::Base:0x10446e510>
```

Expand Down Expand Up @@ -1253,7 +1253,7 @@ The comments form looks a little silly with "Author Name". It should probably sa
<%= f.label :author_name, "Your Name" %>
```

Change your `_comment_form.html.erb` so it has labels "Your Name" and "Your Comment".
Change your `comments/_form.html.erb` so it has labels "Your Name" and "Your Comment".

#### Add a Timestamp to the Comment Display

Expand Down

0 comments on commit e2d2b26

Please sign in to comment.