Sha256: e192e0abdf07982586684023adeb93967f2915aac05d7afeca22f524ab850563
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module Decidim module Admin # A form object used to create participatory processes from the admin # dashboard. # class ParticipatoryProcessForm < Rectify::Form include TranslatableAttributes translatable_attribute :title, String translatable_attribute :subtitle, String translatable_attribute :description, String translatable_attribute :short_description, String mimic :participatory_process attribute :slug, String attribute :hashtag, String attribute :promoted, Boolean attribute :hero_image attribute :banner_image validates :slug, presence: true translatable_validates :title, :subtitle, :description, :short_description, presence: true validate :slug, :slug_uniqueness private def slug_uniqueness return unless ParticipatoryProcess.where(slug: slug).where.not(id: id).any? errors.add( :slug, I18n.t("models.participatory_process.validations.slug_uniqueness", scope: "decidim.admin") ) end end end end
Version data entries
4 entries across 4 versions & 2 rubygems