1 class DiaryComment < ActiveRecord::Base
3 belongs_to :diary_entry
5 validates_presence_of :body
6 validates_associated :diary_entry
8 after_initialize :set_defaults
12 RichText.new(read_attribute(:body_format), read_attribute(:body))
17 md5 << diary_entry_id.to_s
19 md5 << created_at.xmlschema
27 self.body_format = "markdown" unless self.attribute_present?(:body_format)