Class: Decidim::Votings::Admin::DestroyPollingStation

Inherits:
Rectify::Command
  • Object
show all
Defined in:
app/commands/decidim/votings/admin/destroy_polling_station.rb

Overview

This command is executed when the user destroys a polling station from the admin panel.

Instance Method Summary collapse

Constructor Details

#initialize(polling_station, current_user) ⇒ DestroyPollingStation

Returns a new instance of DestroyPollingStation.



9
10
11
12
# File 'app/commands/decidim/votings/admin/destroy_polling_station.rb', line 9

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

Instance Method Details

#callObject

Destroys the polling station if valid.

Broadcasts :ok if successful, :invalid otherwise.



17
18
19
20
21
# File 'app/commands/decidim/votings/admin/destroy_polling_station.rb', line 17

def call
  destroy_polling_station!

  broadcast(:ok, polling_station)
end