mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-19 09:56:03 +01:00
12 lines
359 B
Ruby
12 lines
359 B
Ruby
class Report < ActiveRecord::Base
|
|
belongs_to :user
|
|
has_many :moderation_votes, dependent: :destroy
|
|
has_many :moderation_comments, dependent: :destroy
|
|
validates :type, presence: true
|
|
validates :target_id, presence: true
|
|
validates :user_id, presence: true
|
|
|
|
def target
|
|
type.sub('Reports::', '').constantize.where(id: target_id).first
|
|
end
|
|
end
|