Sha256: 7dacdf9c407b1a7a3b6fcfa302e991f37085a4331d28af040c21770ffd71bba5
Contents?: true
Size: 598 Bytes
Versions: 37
Compression:
Stored size: 598 Bytes
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim # A concern with the features needed when you want a model to 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
37 entries across 37 versions & 2 rubygems