Sha256: abd2ce525274eb2e673196b3b5fd935cbf02e12b931916c2a4cd14b853cd0643
Contents?: true
Size: 806 Bytes
Versions: 51
Compression:
Stored size: 806 Bytes
Contents
# frozen_string_literal: true module Decidim module Consultations module Admin # A form object used to create questions for a consultation from the admin dashboard. class QuestionConfigurationForm < Form include TranslatableAttributes mimic :question attribute :max_votes, Integer, default: 1 attribute :min_votes, Integer, default: 1 translatable_attribute :instructions, String validates :max_votes, numericality: { greater_than_or_equal_to: 1 } validates :min_votes, numericality: { greater_than_or_equal_to: 1 } validate :min_lower_than_max def min_lower_than_max return if min_votes.to_i <= max_votes.to_i errors.add(:max_votes, :lower_than_min) end end end end end
Version data entries
51 entries across 51 versions & 1 rubygems