Class: Decidim::ParticipatoryProcesses::Admin::DestroyParticipatoryProcessGroup

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

Overview

A command with all the business logic when deleting a ParticipatoryProcessGroup.

Instance Method Summary collapse

Constructor Details

#initialize(participatory_process_group, current_user) ⇒ DestroyParticipatoryProcessGroup

Public: Initializes the command.

participatory_process_group - the ParticipatoryProcessGroup to delete. current_user - the user performing this action


12
13
14
15
# File 'decidim-participatory_processes/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_group.rb', line 12

def initialize(participatory_process_group, current_user)
  @participatory_process_group = participatory_process_group
  @current_user = current_user
end

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when the record could be deleted.

  • :invalid when the record couldn't be deleted.

Returns nothing.


23
24
25
26
27
28
# File 'decidim-participatory_processes/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_group.rb', line 23

def call
  destroy_process_group
  broadcast(:ok)
rescue ActiveRecord::RecordNotDestroyed
  broadcast(:invalid)
end