Sha256: f3a68faccafd063aa7f00d2f2453884ca32a813016f2487d5a0fb19809b208cd
Contents?: true
Size: 833 Bytes
Versions: 12
Compression:
Stored size: 833 Bytes
Contents
# frozen_string_literal: true module Decidim class Amendment < ApplicationRecord STATES = %w(draft evaluating accepted rejected withdrawn).freeze 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 validates :state, presence: true, inclusion: { in: STATES } def draft? state == "draft" end def evaluating? state == "evaluating" end def rejected? state == "rejected" end def promoted? return false unless rejected? emendation.linked_promoted_resource.present? end end end
Version data entries
12 entries across 12 versions & 1 rubygems