Class: Decidim::ParticipatoryProcesses::Admin::DestroyParticipatoryProcessType

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

Overview

A command with all the business logic when destroying 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, current_user) ⇒ DestroyParticipatoryProcessType

Public: Initializes the command.

participatory_process_type - A participatory_process_type object to destroy current_user - the user performing the action



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

def initialize(participatory_process_type, current_user)
  @participatory_process_type = participatory_process_type
  @current_user = current_user
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
# File 'decidim-participatory_processes/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_type.rb', line 25

def call
  destroy_participatory_process_type!

  broadcast(:ok)
end