]> git.openstreetmap.org Git - rails.git/blob - app/models/map_bug_comment.rb
Make the edit action default to z17
[rails.git] / app / models / map_bug_comment.rb
1 class MapBugComment < ActiveRecord::Base
2   set_table_name 'map_bug_comment'
3
4   belongs_to :map_bug, :foreign_key => 'bug_id'
5   belongs_to :user, :foreign_key => 'commenter_id'
6
7   validates_inclusion_of :event, :in => [ "opened", "closed", "reopened", "commented", "hidden" ]
8   validates_presence_of :id, :on => :update
9   validates_uniqueness_of :id
10   validates_presence_of :visible
11   validates_presence_of :date_created
12
13   def commenter_name
14     if self.commenter_id.nil?
15       self.read_attribute(:commenter_name)
16     else
17       self.user.display_name
18     end
19   end
20 end