Sha256: 7a7669927ee7746d85050ff1917bf9c3276f09482f1cdc2cd03ffb3d3d328c1e
Contents?: true
Size: 471 Bytes
Versions: 88
Compression:
Stored size: 471 Bytes
Contents
# frozen_string_literal: true module Decidim class ParticipatorySpaceLink < ApplicationRecord belongs_to :from, polymorphic: true belongs_to :to, polymorphic: true validates :name, presence: true, uniqueness: { scope: [:from, :to] } validate :same_organization private def same_organization return if from.try(:organization) == to.try(:organization) errors.add(:from, :invalid) errors.add(:to, :invalid) end end end
Version data entries
88 entries across 88 versions & 1 rubygems