Module: Decidim::Scopable
- Extended by:
- ActiveSupport::Concern
- Included in:
- ParticipatoryProcess
- Defined in:
- decidim-core/lib/decidim/scopable.rb
Overview
This concern contains the logic related to scopes.
Instance Method Summary collapse
-
#has_subscopes? ⇒ Boolean
Whether the resource has subscopes or not.
-
#subscopes ⇒ Object
Gets the children scopes of the object’s scope.
Instance Method Details
#has_subscopes? ⇒ Boolean
Whether the resource has subscopes or not.
Returns a boolean.
29 30 31 |
# File 'decidim-core/lib/decidim/scopable.rb', line 29 def has_subscopes? scopes_enabled && subscopes.any? end |
#subscopes ⇒ Object
Gets the children scopes of the object’s scope.
If it’s global, returns the organization’s top scopes.
Returns an ActiveRecord::Relation.
22 23 24 |
# File 'decidim-core/lib/decidim/scopable.rb', line 22 def subscopes scope ? scope.children : organization.top_scopes end |