]> git.openstreetmap.org Git - rails.git/blob - app/models/diary_comment.rb
Make more use of named scopes
[rails.git] / app / models / diary_comment.rb
1 class DiaryComment < ActiveRecord::Base
2   belongs_to :user
3   belongs_to :diary_entry
4
5   validates_presence_of :body
6   validates_associated :diary_entry
7
8   def digest
9     md5 = Digest::MD5.new
10     md5 << diary_entry_id.to_s
11     md5 << user_id.to_s
12     md5 << created_at.xmlschema
13     md5 << body
14     md5.hexdigest
15   end
16 end