ref: master
app/models/abuse_report.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
class AbuseReport < ApplicationRecord attr_accessible :content, :reason belongs_to :reporter, :class_name => 'Person' belongs_to :abuse_complaint has_many :reported_images, :dependent => :destroy validates_presence_of :reporter, :abuse_complaint, :reason validates_uniqueness_of :reporter_id, :scope => :abuse_complaint_id xss_terminate :sanitize => [:reason] after_create do |abuse_report| abuse_report.abuse_complaint.save! end end |