Class: Decidim::Votings::SignPollingStationClosure
- Defined in:
- decidim-elections/app/commands/decidim/votings/sign_polling_station_closure.rb
Overview
A command with all the business logic when signing a closure of a polling station
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, closure) ⇒ SignPollingStationClosure
constructor
Public: Initializes the command.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form, closure) ⇒ SignPollingStationClosure
Public: Initializes the command.
form - A form object with the params. closure - A closure object.
11 12 13 14 |
# File 'decidim-elections/app/commands/decidim/votings/sign_polling_station_closure.rb', line 11 def initialize(form, closure) @form = form @closure = closure end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
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.
22 23 24 25 26 27 28 |
# File 'decidim-elections/app/commands/decidim/votings/sign_polling_station_closure.rb', line 22 def call return broadcast(:invalid) if form.invalid? closure.update!(signed_at:, phase: :complete) broadcast(:ok) end |