I am creating a blog to learn ruby on rails.
I have 2 different views/models/controllers, 1 called post and 1 called
comments. How do i link a post from the views/post directory to the
comments that belong to the post in the views/comment directory.
This is the code in the post/show.rhtml
<%= render :partial => “post”, :object => @post %>
<%= link_to ‘Back’, :action => ‘list’ %>
<%= render :partial => “comment/comment”, :collection => @comments, :id
=> @post.id %>
This the code in the comment_comment.rhtml
<%= link_to comment.body, :action => 'show', :id => comment.post_id %>
I keep getting the “You have a nil object when you didn’t expect it!”
error message. I have tried everything i can think off.
Can anyone help?