Sha256: 8ade85ae2b1da54e27c749eec935f3901cac7287c348004b4f89924b6717845c

Contents?: true

Size: 541 Bytes

Versions: 25

Compression:

Stored size: 541 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 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
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-core-0.24.2 app/models/decidim/attachment_collection.rb
decidim-core-0.24.1 app/models/decidim/attachment_collection.rb
decidim-core-0.24.0 app/models/decidim/attachment_collection.rb
decidim-core-0.24.0.rc2 app/models/decidim/attachment_collection.rb
decidim-core-0.24.0.rc1 app/models/decidim/attachment_collection.rb