Sha256: 02b0f3483cea1fe76d803a0c7e758169d119d52a449a4bedd067a9898cd847e9
Contents?: true
Size: 720 Bytes
Versions: 15
Compression:
Stored size: 720 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # A form object to create or update pages. class StaticPageForm < Form include TranslatableAttributes attribute :slug, String translatable_attribute :title, String translatable_attribute :content, String mimic :static_page validates :slug, presence: true validates :title, :content, translatable_presence: true validate :slug, :slug_uniqueness alias organization current_organization private def slug_uniqueness return unless organization && organization.static_pages.where(slug: slug).where.not(id: id).any? errors.add(:slug, :taken) end end end end
Version data entries
15 entries across 15 versions & 2 rubygems