Class: Decidim::ParticipatoryProcesses::Admin::UpdateParticipatoryProcessType

Inherits:
Command
  • Object
show all
Defined in:
decidim-participatory_processes/app/commands/decidim/participatory_processes/admin/update_participatory_process_type.rb

Overview

A command with all the business logic when updating a participatory process type in the system.

Instance Method Summary collapse

Methods inherited from Command

call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events

Constructor Details

#initialize(participatory_process_type, form) ⇒ UpdateParticipatoryProcessType

Public: Initializes the command.

participatory_process_type - A participatory_process_type object to update form - A form object with the params.



14
15
16
17
# File 'decidim-participatory_processes/app/commands/decidim/participatory_processes/admin/update_participatory_process_type.rb', line 14

def initialize(participatory_process_type, form)
  @participatory_process_type = participatory_process_type
  @form = form
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Decidim::Command

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if the form was not valid and we could not proceed.

Returns nothing.



25
26
27
28
29
30
31
# File 'decidim-participatory_processes/app/commands/decidim/participatory_processes/admin/update_participatory_process_type.rb', line 25

def call
  return broadcast(:invalid) if form.invalid?

  update_participatory_process_type!

  broadcast(:ok)
end