Class: Decidim::Area
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::Area
- Includes:
- Loggable, Traceable, TranslatableResource
- Defined in:
- app/models/decidim/area.rb
Overview
Areas are used in Assemblies to help users know which is the Area of a participatory space.
Class Method Summary collapse
Instance Method Summary collapse
-
#abort_if_dependencies ⇒ Object
used on before_destroy.
- #has_dependencies? ⇒ Boolean
- #translated_name ⇒ Object
Class Method Details
.log_presenter_class_for(_log) ⇒ Object
28 29 30 |
# File 'app/models/decidim/area.rb', line 28 def self.log_presenter_class_for(_log) Decidim::AdminLog::AreaPresenter end |
Instance Method Details
#abort_if_dependencies ⇒ Object
used on before_destroy
48 49 50 |
# File 'app/models/decidim/area.rb', line 48 def abort_if_dependencies throw(:abort) if has_dependencies? end |
#has_dependencies? ⇒ Boolean
36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/decidim/area.rb', line 36 def has_dependencies? Decidim.participatory_space_registry.manifests.any? do |manifest| manifest .participatory_spaces .call(organization) .any? do |space| space.respond_to?(:area) && space.decidim_area_id == id end end end |
#translated_name ⇒ Object
32 33 34 |
# File 'app/models/decidim/area.rb', line 32 def translated_name Decidim::AreaPresenter.new(self).translated_name end |