title: Nested comments and replies in Ruby on Rails
body: <p>I am working on my first project in ruby on rails and need to implement comments and replies functionality on it. I am facing of displaying replies under each comment as well as if any reply has child replies they need to display under it.
  The structure will be some how as follow.</p>
  <pre><code>first comment
         Reply to first comment
              reply to first comment first reply
         reply to first  comment
  Second comment
        Reply to second comment
  </code></pre>
  <p>and this nested structure continues.
  I have only one table for these all comments with parent key to treat as a reply.
  The table structure is as follow</p>
  <pre><code>Id | Comment_body | parent_id | user_id | project_id
  1      comment                        2          2
  2      comment/reply   1              2          2
  3      comment/reply   2              2          2
  </code></pre>
  <p>this second comment is treated as a reply to the first comment and id 3 comment is treated as a reply to the first reply of the first comment.
  kindly help regarding this nested structure that how I can manage it in the best way.
  The comment table also has an association with the project table and user table.
  suggest the best way without gem as I already tried many of them but they are limited in-depth level.</p>