]> git.openstreetmap.org Git - rails.git/blob - app/models/diary_comment.rb
Avoid mass assignment error in spam observer
[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   attr_accessible :body
9
10   def digest
11     md5 = Digest::MD5.new
12     md5 << diary_entry_id.to_s
13     md5 << user_id.to_s
14     md5 << created_at.xmlschema
15     md5 << body
16     md5.hexdigest
17   end
18 end