Threaded forum

I’m having trouble sensibly designing a forum-type application with real
threads. Whereas most forums have flat threads, my threads are actually
“threaded” if you get what I mean, ie they are displayed in a fashion
such as

Post
-Reply
–Reply

and so on.

So my first attempt was to use acts_as_tree. Unfortunately I found it
impossible to grab an entire thread with this. I could grab one post
and its immediate children, but I couldn’t grab those children’s
children without more queries for each depth level. Depending on the
depth of a thread, massive amounts of queries could be run because of
this.

I later learned about acts_as_nested_set, which seemed like a better
solution. It has a method #all_children which would effectively grab
all the children - regardless of depth - of an object. I thought this
would work, but acts_as_nested_set seems underpowered. For example,
with acts_as_tree I can do post.root and I will get the post at the very
top of the tree. For some reason acts_as_nested_set doesn’t have this,
and I need this feature for a reason: i want to bump a thread when it
has been replied to, but I can’t effectively change the bumped_on
timestamp of the root of the thread without being able to effectively
find the root.

My only other hope was acts_as_threaded, which is a plugin supposedly
designed for threads. Unfortunately the site on which the plugin is
located has been down for a few days and for some reason I doubt it will
be back up.

So I’m kind of out of ideas here. I mean the threaded forum paradigm is
pretty old, so there must be a sensible design pattern for this. I just
don’t know what it is.

Eleo,
I’m having the same issue. I’d love to see some OSS project that’s
implemented threaded comments, but so far haven’t found anything.
Chowhound.com which is Rails is the perfect example of what I’d like to
do.

here’s a mirror of acts_as_threaded:
http://marcusvorwaller.com/acts_as_threaded.zip

-Marcus

Eleo wrote:

I’m having trouble sensibly designing a forum-type application with real
threads. Whereas most forums have flat threads, my threads are actually
“threaded” if you get what I mean, ie they are displayed in a fashion
such as

Post
-Reply
–Reply

and so on.

So my first attempt was to use acts_as_tree. Unfortunately I found it
impossible to grab an entire thread with this. I could grab one post
and its immediate children, but I couldn’t grab those children’s
children without more queries for each depth level. Depending on the
depth of a thread, massive amounts of queries could be run because of
this.

I later learned about acts_as_nested_set, which seemed like a better
solution. It has a method #all_children which would effectively grab
all the children - regardless of depth - of an object. I thought this
would work, but acts_as_nested_set seems underpowered. For example,
with acts_as_tree I can do post.root and I will get the post at the very
top of the tree. For some reason acts_as_nested_set doesn’t have this,
and I need this feature for a reason: i want to bump a thread when it
has been replied to, but I can’t effectively change the bumped_on
timestamp of the root of the thread without being able to effectively
find the root.

My only other hope was acts_as_threaded, which is a plugin supposedly
designed for threads. Unfortunately the site on which the plugin is
located has been down for a few days and for some reason I doubt it will
be back up.

So I’m kind of out of ideas here. I mean the threaded forum paradigm is
pretty old, so there must be a sensible design pattern for this. I just
don’t know what it is.

Thanks for the acts_as_threaded mirror.

Last night I discovered “better nested set” which adds useful functions
to acts_as_nested_set. For example you can do object.root and so on. I
have yet to test it out, though.

Eleo wrote:

Googlable but I should have left a link out of courtesy:

http://opensource.symetrie.com/trac/better_nested_set/

And yeah, the example you provided is basically -exactly- what I’m
trying to achieve, right down to the AJAX comment box appearing
underneath the post one is trying to reply to.

Chowhound is also googlable but it’s by PJ Hyett and Chris W. who
have one of the (IMHO) best Rails blogs out there. Here’s a particularly
useful post:

Googlable but I should have left a link out of courtesy:

http://opensource.symetrie.com/trac/better_nested_set/

And yeah, the example you provided is basically -exactly- what I’m
trying to achieve, right down to the AJAX comment box appearing
underneath the post one is trying to reply to.

I’m wondering, if you have acts_as_threaded, how come you’re still
unable to implement threaded comments? Is the plugin inadequate?