ramonrails said about 7 years ago on Best threaded comment system for Rails projects :

You may use a combination of

  1. http://guides.rubyonrails.org/association_basics.html#polymorphic-associations
  2. https://github.com/stefankroes/ancestry

for some super awesome threaded hierarchical comments system. Ancestry is optional, just to get some cool queries and filters easily without writing them from scratch.

Hope it helps. Good luck.