Sha256: 584da5be201efacb6080b0bb7759aaa63895fdcae21c4b0ea460dc90391b1215
Contents?: true
Size: 777 Bytes
Versions: 36
Compression:
Stored size: 777 Bytes
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim # This concern contains the logic related to scopes. module Scopable extend ActiveSupport::Concern included do belongs_to :scope, foreign_key: "decidim_scope_id", class_name: "Decidim::Scope", optional: true end # Gets the children scopes of the object's scope. # # If it's global, returns the organization's top scopes. # # Returns an ActiveRecord::Relation. def subscopes scope ? scope.children : organization.top_scopes end # Whether the resource has subscopes or not. # # Returns a boolean. def has_subscopes? scopes_enabled && subscopes.any? end end end
Version data entries
36 entries across 36 versions & 2 rubygems