Forum: Ruby on Rails Bumping threads in a forum-type app

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.
A0f6b57661bc57b6520010a2a333faba?d=identicon&s=25 Eleo (Guest)
on 2006-05-12 23:50
I have a forum-type application.  The Board model has many comments, the
Comments model acts as a tree.  So I have a board with multiple
comments, some comments are parent comments and there are comments that
belong to a parent comment, making up a thread.

Like most forums, I want it so that threads are sorted based on the date
of their last comment.  But I have no idea how to specify this in the
has_many :order of the Board model.

But more than this, I want it so that a thread can only be bumped X many
times; after the Xth comment the board

Previously I was doing it in a rather clunky way with a table column for
each parent comment that specifies when the thread was last replied to.
I don't think this is the cleanest way of doing it but it works.  Any
other ideas?
Fb23bc8cd4030c526b0689276b34c8bd?d=identicon&s=25 Bryan Duxbury (bryanduxbury)
on 2006-05-13 00:29
I would keep using the method with an extra column for last modified. It
seems to me the only other way to track this data would be to do a tree
traversal, and that would be a pain. Plus, with that extra column, you
can just :order by it.
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 steve ross (Guest)
on 2006-05-13 01:01
(Received via mailing list)
Look at acts_as_threaded.

http://www.railtie.net/articles/2006/02/05/rails-a...

Not a 100% solution, but it may get you further than acts_as_tree. You
can count children quite easily using the logic from acts_as_nested_set
and cut people off after X comments.

Ordering is typically not by freshest thread including all replies, but
by freshest start date of a thread. This could be changed by adding a
column to record touch-date.

HTH
A0f6b57661bc57b6520010a2a333faba?d=identicon&s=25 Eleo (Guest)
on 2006-05-13 01:34
steve ross wrote:
> Ordering is typically not by freshest thread including all replies, but
> by freshest start date of a thread. This could be changed by adding a
> column to record touch-date.
>
> HTH

Are you saying this re: the plugin or forums in general?
A0f6b57661bc57b6520010a2a333faba?d=identicon&s=25 Eleo (Guest)
on 2006-05-13 03:14
I'm looking at the plugin, it looks like it will not accomplish my ends.
I'm thinking I will have to create my own method(s) to get this to work.

I've seen forums work without having a column for the last date
accessed.  I guess a part of me feels I shouldn't _have_ to create a
column like that when such information can be derived by other aspects
of the database.

Is my approach flawed in this repect?
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 steve ross (Guest)
on 2006-05-13 08:55
(Received via mailing list)
Re the plugin. My understanding is that ordering is typically done
--with this plugin-- by the order of the thread root.
This topic is locked and can not be replied to.