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/memo.rb

34 lines
649 B

class Memo < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :forums
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
safe_attributes "author_id",
"subject",
"content",
"forum_id",
"last_reply_id",
"lock",
"parent_id",
"replies_count",
"sticky"
validates_presence_of :author_id, :content, :forum_id, :subject
validates_length_of :subject, maximum: 50
validates_length_of :content, maximum: 2048
def replies
Memo.where("parent_id = ?", id)
end
def locked?
self.lock
end
def editable_by? user
!self.lock
end
def destroyable_by? user
end
end