- # Return the author name
- def author_name
- if self.author_id.nil?
- self.read_attribute(:author_name)
- else
- self.author.display_name
- end
- end
+ validates :id, :uniqueness => true, :presence => { :on => :update },
+ :numericality => { :on => :update, :only_integer => true }
+ validates :note, :associated => true
+ validates :visible, :inclusion => [true, false]
+ validates :author, :associated => true
+ validates :event, :inclusion => %w[opened closed reopened commented hidden]
+ validates :body, :length => { :maximum => 2000 }, :characters => true