Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I create a reply comment system?

Jake Yeaton asked in Rails
I have been trying to get the hang of rails and I understand most of Rails but I'm currently stuck on how I would go about and create a reply commenting system. For example, just like on GoRails. 

Can anyone point me in the correct direction?

I have created a standard comment system which was copied from the GoRails episode. 

Thank you ahead of time.
Reply
Hey Jake,

Just to make sure I understand your goals, you want to integrate a Comment + Reply model(s) integration with a Rails app? Are you using AJAX?

I'd be glad to assist, just need a little more info. Can you reference which GoRails episode you're
 talking about?
Reply
Yes, i'm trying to integrate just that into my rails app. 

 I'm using AJAX. 

Yeah, this episode: https://gorails.com/episodes/comments-with-polymorphic-associations

Thank you so much Ryan.
Reply
My pleasure. 

Have you successfully re-created the Comments/Modules/Models that Chris went over in the video?  Have you successfully integrated AJAX thus far? Once you understand the workflow that was followed you can simply extend it using another instance(s) of poly associations or simple has_many/belong_to associations.

I will update a git repo with an example this weekend if you need something to look through. In the meantime, if you've got a repo feel free to link to it and I will give it a look.

We can get you squared away.

Reply
Yes, I have completed all of that and I will give extending it using another instance(s) of poly associations, etc a try! 

I guess that part that I'm having a difficult time understanding how to accomplish is how to create a Reddit style comment system. So for example, if I reply to you then my comments will show in the view under yours and to the right a little bit. Then you respond and it's under my comment and a little more to the right, ect. 

Do you understand how to accomplish this? 
Reply

hey chris tried to report the above posts as spam and got This gorails.com page can’t be foundNo web page was found for the web address: https://gorails.com/forum/how-do-i-create-a-reply-comment-system/forum_posts/11741/report

just an fyi

Reply

Very helpful information. I took your advice and everything started to work, I had a similar error

Reply

Hi Jake, you had made a comment system for one of our client.
If you are looking to outsource project, our team at techtix will be happy to help.

Reply

thank you

Reply

From a ready-made template, everything will be easier.

Reply

Only offline non-pauseable.

Reply

To create a reply commenting system, you will need to modify your existing comment system to include a parent-child relationship between comments.
Add a parent_comment_id column to your comments table. This column will store the ID of the parent comment that a reply is associated with.

Reply
Join the discussion
Create an account Log in

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

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

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