Ask A Question

Notifications

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.

Reply

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

Reply

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?

Reply

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

Reply

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!

Reply
Join the discussion
Create an account Log in

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

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

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

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.