Sha256: c8d115d17cd43956e9c4ae5666910a23e6f6765de1d9115ddf28730c06a96947
Contents?: true
Size: 1.21 KB
Versions: 35
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true module Decidim # A moderation belongs to a reportable and includes many reports class Moderation < ApplicationRecord include Traceable include Loggable belongs_to :reportable, foreign_key: "decidim_reportable_id", foreign_type: "decidim_reportable_type", polymorphic: true, touch: true belongs_to :participatory_space, foreign_key: "decidim_participatory_space_id", foreign_type: "decidim_participatory_space_type", polymorphic: true has_many :reports, foreign_key: "decidim_moderation_id", class_name: "Decidim::Report", dependent: :destroy delegate :component, :organization, to: :reportable scope :hidden, -> { where.not(hidden_at: nil) } scope :not_hidden, -> { where(hidden_at: nil) } def self.log_presenter_class_for(_log) Decidim::AdminLog::ModerationPresenter end ransacker :reported_id_string do Arel.sql(%{cast("decidim_moderations"."decidim_reportable_id" as text)}) end ransacker :reported_content do Arel.sql(%{cast("decidim_moderations"."reported_content" as text)}) end ransacker :reportable_type_string do Arel.sql(%{cast("decidim_moderations"."decidim_reportable_type" as text)}) end end end
Version data entries
35 entries across 35 versions & 1 rubygems