sharmano sharmano - 9 months ago 21
Ruby Question

Why are the comments not showing up in ruby on rails?

I made a ruby on rails blog as part of my project. I wanted to add comments to my blog. However, the site takes the comment and stores it successfully but when it comes to showing the comments, it doesn't work. I checked if the comment was registered using the rails console and it is registered. The github repository for it is :

Note: If specific code is needed, please let me know in the comments


I think it should be:

<%= div_for @comments do |comment| %>

I'm a bit surprised it does not throw any error here.

Edit: You also don't set @comments instance variable anywhere in the controller: You should do it or use @post.comments instead.