|
|
|
@ -8,7 +8,6 @@ class Memo < ActiveRecord::Base
|
|
|
|
|
validates_length_of :subject, maximum: 50
|
|
|
|
|
validates_length_of :content, maximum: 2048
|
|
|
|
|
validate :cannot_reply_to_locked_topic, :on => :create
|
|
|
|
|
validate :content_cannot_be_blank
|
|
|
|
|
|
|
|
|
|
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"
|
|
|
|
|
acts_as_attachable
|
|
|
|
@ -50,9 +49,6 @@ class Memo < ActiveRecord::Base
|
|
|
|
|
def cannot_reply_to_locked_topic
|
|
|
|
|
errors.add :base, 'Topic is locked' if root.locked? && self != root
|
|
|
|
|
end
|
|
|
|
|
def content_cannot_be_blank
|
|
|
|
|
errors.add :base, "content can't be blank." if self.content.blank?
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# def update_memos_forum
|
|
|
|
|
# if forum_id_changed?
|
|
|
|
|