]> git.openstreetmap.org Git - rails.git/blob - app/models/note_comment.rb
Mass rename of "bugs" as "notes" for increased user friendliness
[rails.git] / app / models / note_comment.rb
1 class NoteComment < ActiveRecord::Base
2   belongs_to :note, :foreign_key => :bug_id
3   belongs_to :author, :class_name => "User", :foreign_key => :author_id
4
5   validates_inclusion_of :event, :in => [ "opened", "closed", "reopened", "commented", "hidden" ]
6   validates_presence_of :id, :on => :update
7   validates_uniqueness_of :id
8   validates_presence_of :visible
9
10   def author_name
11     if self.author_id.nil?
12       self.read_attribute(:author_name)
13     else
14       self.author.display_name
15     end
16   end
17 end