Sha256: 5bf45a8b5c356ef242f16dc66fdb1e33cb7e8047f0ae058cd6e57ae1b502ebb9
Contents?: true
Size: 596 Bytes
Versions: 1
Compression:
Stored size: 596 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.2.0 | lib/decidim/has_category.rb |