class Forum < ActiveRecord::Base acts_as_list validates_presence_of :name has_many :moderatorships, :dependent => :destroy has_many :moderators, :through => :moderatorships, :source => :user, :order => 'users.login' has_many :topics, :order => 'sticky desc, replied_at desc', :dependent => :destroy do def first @first_topic ||= find(:first) end end has_many :posts, :order => 'posts.created_at desc' do def last @last_post ||= find(:first) end end format_attribute :description end