Sha256: 62c01a154654604a3f8dbc17a278ce51f33e6835a558b02646b26587940a0ae2
Contents?: true
Size: 593 Bytes
Versions: 6
Compression:
Stored size: 593 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 belongs_to :category, foreign_key: "decidim_category_id", class_name: Decidim::Category 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
6 entries across 6 versions & 1 rubygems