Forum: Ruby on Rails Implementing commenting system using acts_as_nested_set

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C0dce094a2af043d002c0c957530003c?d=identicon&s=25 Love AJAX (Guest)
on 2007-07-24 12:43
(Received via mailing list)
Hi,

I have been trying to implemented a commenting system for my Job
model. I pretty much got my model to work using (better_)
acts_as_nested_set. But I am finding it difficult to display the
comments in views. How would I recurse the comment tree and display
the comment details for each child. I was thinking of something like
this:

---------Controller------------
@comments = job.comments

------------View------------
for comment in @comments
  <p> display comment details here </p>
  <% --recurse-- unless comment.children.empty? %>
end

Any help?

Thanks much.
This topic is locked and can not be replied to.