Ask A Question


You’re not receiving notifications from this thread.

How do I make commentable comments available on the index page?

Thomas Connolly asked in General

I've got the polymorphic comments working on the two show pages, but I want to show all my posts (and reports) along with their comments on the two respective index pages. I can't seem to get it.


I should be able to delete this post, but don't see where it's possible.


Did you get it working? I wasn't around for the holidays for a bit.

I believe you can eager load the comments through the association in the index query and then just use the association to render them out on the index page. Is that what you ended up doing?


Yes, thank you. Now I am working on ajaxifying the comments. Anything I should watch out for?


Nothing really. It's pretty straightforward. You just want to use remote: true on the form and add the JS response to the action like you normally would. That's about it!

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,453+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.