Class: Decidim::ParticipatoryProcess
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::ParticipatoryProcess
- Includes:
- HasAttachments
- Defined in:
- app/models/decidim/participatory_process.rb
Overview
Interaction between a user and an organization is done via a ParticipatoryProcess. It’s a unit of action from the Organization point of view that groups several features (proposals, debates…) distributed in steps that get enabled or disabled depending on which step is currently active.
Class Method Summary collapse
-
.promoted ⇒ Object
Scope to return only the promoted processes.
-
.published ⇒ Object
Scope to return only the published processes.
Instance Method Summary collapse
-
#documents ⇒ Object
All the attachments that are documents for this porcess.
-
#photos ⇒ Object
All the attachments that are photos for this porcess.
-
#published? ⇒ Boolean
Checks whether the process has been published or not.
Class Method Details
.promoted ⇒ Object
Scope to return only the promoted processes.
Returns an ActiveRecord::Relation.
53 54 55 |
# File 'app/models/decidim/participatory_process.rb', line 53 def self.promoted where(promoted: true) end |
.published ⇒ Object
Scope to return only the published processes.
Returns an ActiveRecord::Relation.
46 47 48 |
# File 'app/models/decidim/participatory_process.rb', line 46 def self.published where.not(published_at: nil) end |
Instance Method Details
#documents ⇒ Object
All the attachments that are documents for this porcess.
Returns an Array<Attachment>
74 75 76 |
# File 'app/models/decidim/participatory_process.rb', line 74 def documents @documents ||= .select(&:document?) end |
#photos ⇒ Object
All the attachments that are photos for this porcess.
Returns an Array<Attachment>
67 68 69 |
# File 'app/models/decidim/participatory_process.rb', line 67 def photos @photos ||= .select(&:photo?) end |
#published? ⇒ Boolean
Checks whether the process has been published or not.
Returns a boolean.
60 61 62 |
# File 'app/models/decidim/participatory_process.rb', line 60 def published? published_at.present? end |