Class: Decidim::ParticipatoryProcess

Inherits:
ApplicationRecord show all
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

Instance Method Summary collapse

Class Method Details

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

.publishedObject

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

#documentsObject

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 ||= attachments.select(&:document?)
end

#photosObject

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 ||= attachments.select(&:photo?)
end

#published?Boolean

Checks whether the process has been published or not.

Returns a boolean.

Returns:

  • (Boolean)


60
61
62
# File 'app/models/decidim/participatory_process.rb', line 60

def published?
  published_at.present?
end