Class: Decidim::ParticipatoryProcesses::ParticipatoryProcessesByGroup
- Inherits:
-
Query
- Object
- Query
- Decidim::ParticipatoryProcesses::ParticipatoryProcessesByGroup
- Defined in:
- app/queries/decidim/participatory_processes/participatory_processes_by_group.rb
Overview
A class used to find the ParticipatoryProcesses from a ProcessGroup.
Class Method Summary collapse
-
.for(process_group) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
Instance Method Summary collapse
-
#initialize(process_group) ⇒ ParticipatoryProcessesByGroup
constructor
Initializes the class.
- #processes ⇒ Object
- #query ⇒ Object
Constructor Details
#initialize(process_group) ⇒ ParticipatoryProcessesByGroup
Initializes the class.
13 14 15 |
# File 'app/queries/decidim/participatory_processes/participatory_processes_by_group.rb', line 13 def initialize(process_group) @process_group = process_group end |
Class Method Details
.for(process_group) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
8 9 10 |
# File 'app/queries/decidim/participatory_processes/participatory_processes_by_group.rb', line 8 def self.for(process_group) new(process_group).query end |
Instance Method Details
#processes ⇒ Object
17 18 19 |
# File 'app/queries/decidim/participatory_processes/participatory_processes_by_group.rb', line 17 def processes ParticipatoryProcess end |
#query ⇒ Object
21 22 23 24 25 |
# File 'app/queries/decidim/participatory_processes/participatory_processes_by_group.rb', line 21 def query return processes.all unless @process_group processes.where(participatory_process_group: @process_group) end |