You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trustieforge/app/models/forum.rb

21 lines
768 B

class Forum < ActiveRecord::Base
include Redmine::SafeAttributes
has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC"
has_many :memos, :dependent => :destroy
belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id'
safe_attributes 'name',
'description',
'topic_count',
'memo_count',
'last_memo_id',
'creator_id'
validates_presence_of :name, :creator_id
validates_length_of :name, maximum: 50
validates_length_of :description, maximum: 255
validates :name, :uniqueness => true
acts_as_taggable
scope :by_join_date, order("created_at DESC")
end