Sha256: 7373c3bc26d3a4fc8f4c780685342e011dd917b7e147155ba74db884a5f3d4cf

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module Decidim
  class ParticipatoryProcessGroup < ApplicationRecord
    include Decidim::Resourceable
    include Decidim::Traceable
    include Decidim::HasUploadValidations
    include Decidim::TranslatableResource

    translatable_fields :title, :description, :developer_group, :local_area, :meta_scope, :participatory_scope,
                        :participatory_structure, :target

    has_many :participatory_processes,
             foreign_key: "decidim_participatory_process_group_id",
             class_name: "Decidim::ParticipatoryProcess",
             inverse_of: :participatory_process_group,
             dependent: :nullify

    belongs_to :organization,
               foreign_key: "decidim_organization_id",
               class_name: "Decidim::Organization"

    validates_upload :hero_image
    mount_uploader :hero_image, Decidim::HeroImageUploader

    # Scope to return only the promoted groups.
    #
    # Returns an ActiveRecord::Relation.
    def self.promoted
      where(promoted: true)
    end

    def self.log_presenter_class_for(_log)
      Decidim::ParticipatoryProcesses::AdminLog::ParticipatoryProcessGroupPresenter
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.24.3 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.24.2 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.24.1 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.24.0 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.24.0.rc2 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.24.0.rc1 app/models/decidim/participatory_process_group.rb