Skip to content
Extraits de code Groupes Projets
report.rb 369 octets
Newer Older
  • Learn to ignore specific revisions
  • class Report < ActiveRecord::Base
    
    Lukas Matt's avatar
    Lukas Matt a validé
      validates :user_id, presence: true
      validates :post_id, presence: true
    
      validates :post_type, presence: true
    
    Lukas Matt's avatar
    Lukas Matt a validé
    
      belongs_to :user
      belongs_to :post
    
    
      has_many :reports  
    
    Lukas Matt's avatar
    Lukas Matt a validé
    
      after_create :send_report_notification
    
      def send_report_notification
    
        Workers::Mail::ReportWorker.perform_async(self.post_type, self.post_id)
    
    Lukas Matt's avatar
    Lukas Matt a validé
      end
    end