Sha256: 305b629ee90ae76aaed3de808e1213c0a5a55d9c7c8b4424a4783d7ccfb9ce17
Contents?: true
Size: 866 Bytes
Versions: 14
Compression:
Stored size: 866 Bytes
Contents
class Topic < ActiveRecord::Base has_site if respond_to? :has_site has_comments belongs_to :forum belongs_to :replied_by, :class_name => 'Reader' validates_presence_of :name validates_uniqueness_of :old_id, :allow_nil => true named_scope :imported, :conditions => "old_id IS NOT NULL" named_scope :stickyfirst, :order => "topics.sticky DESC, topics.replied_at DESC" named_scope :bydate, :order => 'replied_at DESC' named_scope :latest, lambda { |count| { :order => 'replied_at DESC', :limit => count } } def dom_id "topic_#{self.id}" end def visible_to?(reader=nil) return true if reader || Radiant::Config['forum.public?'] end def reader posts.first.reader end def body posts.first.body end def created_at posts.first.created_at if posts.first end def title name end end
Version data entries
14 entries across 14 versions & 1 rubygems