Sha256: c383ac9793a081acc9671620ed063d666f7bd7b8932a6ce126e1c28df162b767
Contents?: true
Size: 639 Bytes
Versions: 9
Compression:
Stored size: 639 Bytes
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim module Initiatives module HasArea extend ActiveSupport::Concern included do belongs_to :area, foreign_key: "decidim_area_id", class_name: "Decidim::Area", optional: true delegate :areas, to: :organization validate :area_belongs_to_organization end private def area_belongs_to_organization return unless area && organization errors.add(:area, :invalid) unless areas.where(id: area.id).exists? end end end end
Version data entries
9 entries across 9 versions & 1 rubygems