Sha256: 2aee042fcc5b46b2a83954fba514c3c969c910579ad8faf6cdc190b6a836222e

Contents?: true

Size: 670 Bytes

Versions: 25

Compression:

Stored size: 670 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # Categories serve as a taxonomy for attachments to use for while in the
  # context of a participatory space.
  class AttachmentCollection < ApplicationRecord
    include Traceable
    include Decidim::TranslatableResource

    translatable_fields :name, :description
    belongs_to :collection_for, polymorphic: true
    has_many :attachments, class_name: "Decidim::Attachment", dependent: :nullify

    default_scope { order(arel_table[:weight].asc) }

    def unused?
      attachments.empty?
    end

    def self.log_presenter_class_for(_log)
      Decidim::AdminLog::AttachmentCollectionPresenter
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-core-0.27.2 app/models/decidim/attachment_collection.rb
decidim-core-0.27.1 app/models/decidim/attachment_collection.rb
decidim-core-0.27.0 app/models/decidim/attachment_collection.rb
decidim-core-0.27.0.rc2 app/models/decidim/attachment_collection.rb
decidim-core-0.27.0.rc1 app/models/decidim/attachment_collection.rb