Sha256: ef95c2074e3d0ce3b9a29c412b989455f6317c69af255b27be260b57bd079347

Contents?: true

Size: 771 Bytes

Versions: 4

Compression:

Stored size: 771 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ActionDelegator
    # Contains the delegation settings of a consultation. Rather than a single attribute here
    # a setting is the record itself: a bunch of configuration values.
    class Setting < ApplicationRecord
      self.table_name = "decidim_action_delegator_settings"

      belongs_to :consultation,
                 foreign_key: "decidim_consultation_id",
                 class_name: "Decidim::Consultation"
      has_many :delegations,
               inverse_of: :setting,
               foreign_key: "decidim_action_delegator_setting_id",
               dependent: :destroy

      validates :max_grants, presence: true
      validates :max_grants, numericality: { greater_than: 0 }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-action_delegator-0.6.0 app/models/decidim/action_delegator/setting.rb
decidim-action_delegator-0.5.0 app/models/decidim/action_delegator/setting.rb
decidim-action_delegator-0.4.1 app/models/decidim/action_delegator/setting.rb
decidim-action_delegator-0.4 app/models/decidim/action_delegator/setting.rb