Sha256: 31ca879c0ea7c5f0383ef58fde2c0d00d429007ac862e06b3a4ee8ebc2a7f3de
Contents?: true
Size: 582 Bytes
Versions: 18
Compression:
Stored size: 582 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # A form object to create or update scopes. class ScopeForm < Form attribute :name, String attribute :organization, Decidim::Organization mimic :scope validates :name, :organization, presence: true validate :name, :name_uniqueness alias organization current_organization private def name_uniqueness return unless organization && organization.scopes.where(name: name).where.not(id: id).any? errors.add(:name, :taken) end end end end
Version data entries
18 entries across 18 versions & 2 rubygems