Class: Decidim::Votings::Admin::DestroyPollingStation
- Inherits:
-
Command
- Object
- Command
- Decidim::Votings::Admin::DestroyPollingStation
- 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
-
#call ⇒ Object
Destroys the polling station if valid.
-
#initialize(polling_station, current_user) ⇒ DestroyPollingStation
constructor
A new instance of DestroyPollingStation.
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
#call ⇒ Object
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 |