Sha256: de4bd9c74e487c4f28f28564f4e9ee3005b8af8487f166a4a959d1253607d7d0
Contents?: true
Size: 662 Bytes
Versions: 24
Compression:
Stored size: 662 Bytes
Contents
# frozen_string_literal: true module Decidim module Consultations class VoteForm < Form mimic :vote attribute :decidim_consultations_response_id, Integer validates :decidim_consultations_response_id, presence: true validate :response_exists def response @response ||= Response.find_by(id: decidim_consultations_response_id) end private def response_exists return unless response.nil? errors.add( :decidim_consultations_response_id, I18n.t("decidim_consultations_response_id.not_found", scope: "activemodel.errors.vote") ) end end end end
Version data entries
24 entries across 24 versions & 1 rubygems