Sha256: c7bd78f502df88c421cfbcf88b29da0bb16ca903160cb078446f42cbb1967db2

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Decidim
  module Accountability
    # The data store for a Status in the Decidim::Accountability component. It stores a
    # key, a localized name, a localized description and associated progress number.
    class Status < Accountability::ApplicationRecord
      include Decidim::HasComponent
      include Decidim::TranslatableResource
      include Decidim::FilterableResource
      include Decidim::Traceable

      component_manifest_name "accountability"

      translatable_fields :name, :description

      has_many :results, foreign_key: "decidim_accountability_status_id", class_name: "Decidim::Accountability::Result", inverse_of: :status, dependent: :nullify

      validates :key, presence: true, uniqueness: { scope: :decidim_component_id }
      validates :name, presence: true

      # Allow ransacker to search for a key in a hstore column (`name`.`en`)
      ransacker_i18n :name

      def self.log_presenter_class_for(_log)
        Decidim::Accountability::AdminLog::StatusPresenter
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-accountability-0.29.1 app/models/decidim/accountability/status.rb
decidim-accountability-0.29.0 app/models/decidim/accountability/status.rb
decidim-accountability-0.29.0.rc4 app/models/decidim/accountability/status.rb
decidim-accountability-0.29.0.rc3 app/models/decidim/accountability/status.rb
decidim-accountability-0.29.0.rc2 app/models/decidim/accountability/status.rb
decidim-accountability-0.29.0.rc1 app/models/decidim/accountability/status.rb