1 class DiaryComment < ActiveRecord::Base
3 belongs_to :diary_entry
5 validates_presence_of :body
6 validates_associated :diary_entry
10 after_initialize :set_defaults
11 after_save :spam_check
14 RichText.new(read_attribute(:body_format), read_attribute(:body))
19 md5 << diary_entry_id.to_s
21 md5 << created_at.xmlschema
29 self.body_format = "markdown" unless self.attribute_present?(:body_format)