Sha256: d1e417687cbb837a3076d0d4f7843a8e7868e82fb6b9b8cb6c8ebbff0105165a
Contents?: true
Size: 628 Bytes
Versions: 28
Compression:
Stored size: 628 Bytes
Contents
# frozen_string_literal: true require "active_support/concern" require "decidim/feature_validator" module Decidim # A concern with the features needed when you want a model to have a feature. module HasFeature extend ActiveSupport::Concern included do belongs_to :feature, foreign_key: "decidim_feature_id", class_name: "Decidim::Feature" delegate :organization, to: :feature, allow_nil: true end class_methods do def feature_manifest_name(manifest_name) validates :feature, feature: { manifest: manifest_name || name.demodulize.pluralize.downcase } end end end end
Version data entries
28 entries across 28 versions & 2 rubygems