I have built a simple forum but am having difficult getting the topics
to display in the order of their latest reply.
The associations are as follows:
class Forum < ActiveRecord::Base
has_many :topics, :order => “sticky DESC, created_at DESC”
has_many :replies, :through => :topics
class Topic < ActiveRecord::Base
belongs_to :forum
has_many :replies, :order => “created_at”, :dependent => :destroy
class Reply < ActiveRecord::Base
belongs_to :topic
And in my controller I am calling @topics = @forum.topics
What I would like to do is sort the topics by the created_at of their
most recent posts.
Any advice appreciated.
Thanks,
Dan