1 # == Schema Information
5 # id :integer not null, primary key
8 # details :text not null
9 # category :string not null
10 # created_at :datetime not null
11 # updated_at :datetime not null
15 # index_reports_on_issue_id (issue_id)
16 # index_reports_on_user_id (user_id)
20 # reports_issue_id_fkey (issue_id => issues.id) ON DELETE => cascade
21 # reports_user_id_fkey (user_id => users.id) ON DELETE => cascade
24 class Report < ActiveRecord::Base
25 belongs_to :issue, :counter_cache => true
28 validates :details, :presence => true
29 validates :category, :presence => true
31 def self.categories_for(reportable)
32 case reportable.class.name
33 when "DiaryEntry" then %w[spam offensive threat other]
34 when "DiaryComment" then %w[spam offensive threat other]
35 when "User" then %w[spam offensive threat vandal other]
36 when "Note" then %w[spam vandalism personal abusive other]