Error on refractoring ?

When I get down to this section of the ‘Getting Started’ tutorial… 8 Refactoring >> 8.1 Rendering Partial Collections

And I do the first change to the rendering of the existing comments - I get an error…

NoMethodError in Posts#show

Showing C:/Sites/blog/app/views/posts/show.html.erb where line #19 raised:

undefined method `comment’ for #Post:0x3eaaea8

Extracted source (around line #19):


17: 18:


19: <%= render @post.comments %> 20: 21:

Add a comment:

22: <%= form_for([@post,]) do |f| %>

Not sure what I am doing wrong. The created file is named “app/views/comments/_comment.html.erb” as per tutorial. I note the render is @posts.comments and the file name is _comment - is that correct ? TIA, Dave


the tutorial has button ‘Help’ where you can find the link to the author’s Github repository – get over and compare your files to his in the respective commits, or just try renaming the partitial and see if it works.



Thanks for the tip - will check it out ! Dave

All good - works as advertised ! Cheers, Dave