Sha256: 68bef137be40a34f605f515a02eef4b397c675c05a9a4555659bdd24b17dc508
Contents?: true
Size: 601 Bytes
Versions: 7
Compression:
Stored size: 601 Bytes
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim # A concern with the features needed when you want a model to be have a category. module HasCategory extend ActiveSupport::Concern included do has_one :categorization, as: :categorizable has_one :category, through: :categorization validate :category_belongs_to_organization private def category_belongs_to_organization return unless category errors.add(:category, :invalid) unless feature.categories.where(id: category.id).exists? end end end end
Version data entries
7 entries across 7 versions & 1 rubygems