Sha256: 904e2225b97f2a47041b87035f3853344aca15e6e9c505a6572f686cf4a8c553

Contents?: true

Size: 665 Bytes

Versions: 2

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class Amendment < ApplicationRecord
    belongs_to :amendable, foreign_key: "decidim_amendable_id", foreign_type: "decidim_amendable_type", polymorphic: true
    belongs_to :amender, foreign_key: "decidim_user_id", class_name: "Decidim::User"
    belongs_to :emendation, foreign_key: "decidim_emendation_id", foreign_type: "decidim_emendation_type", polymorphic: true

    STATES = %w(evaluating accepted rejected withdrawn).freeze

    def evaluating?
      state == "evaluating"
    end

    def rejected?
      state == "rejected"
    end

    validates :amendable, :amender, :emendation, presence: true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-core-0.18.1 app/models/decidim/amendment.rb
decidim-core-0.18.0 app/models/decidim/amendment.rb