Sha256: e03614ee068d9a1d35647dadc30def9d195443b703ab3cf53e5c7c015db76013

Contents?: true

Size: 612 Bytes

Versions: 5

Compression:

Stored size: 612 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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-core-0.17.2 app/models/decidim/amendment.rb
decidim-core-0.17.1 app/models/decidim/amendment.rb
decidim-core-0.16.1 app/models/decidim/amendment.rb
decidim-core-0.17.0 app/models/decidim/amendment.rb
decidim-core-0.16.0 app/models/decidim/amendment.rb