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

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

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if the form wasn't valid and we couldn't 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