Class: Decidim::Votings::Admin::DestroyPollingOfficer

Inherits:
Command
  • Object
show all
Defined in:
decidim-elections/app/commands/decidim/votings/admin/destroy_polling_officer.rb

Overview

A command with the business logic to destroy a poling officer

Instance Method Summary collapse

Methods inherited from Command

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

Constructor Details

#initialize(polling_officer, current_user) ⇒ DestroyPollingOfficer

Public: Initializes the command.

polling_officer - the PollingOfficer to destroy current_user - the user performing this action



12
13
14
15
# File 'decidim-elections/app/commands/decidim/votings/admin/destroy_polling_officer.rb', line 12

def initialize(polling_officer, current_user)
  @polling_officer = polling_officer
  @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.



23
24
25
26
# File 'decidim-elections/app/commands/decidim/votings/admin/destroy_polling_officer.rb', line 23

def call
  destroy_polling_officer!
  broadcast(:ok)
end