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
13 RichText.new(read_attribute(:body_format), read_attribute(:body))
18 md5 << diary_entry_id.to_s
20 md5 << created_at.xmlschema
28 self.body_format = "markdown" unless self.attribute_present?(:body_format)