Class: Decidim::Elections::Admin::PublishResults
- Inherits:
-
Command
- Object
- Command
- Decidim::Elections::Admin::PublishResults
- Defined in:
- app/commands/decidim/elections/admin/publish_results.rb
Overview
This command gets called to publish the election results in the Bulletin Board.
Instance Method Summary collapse
-
#call ⇒ Object
Public: Publish the results for the Election.
-
#initialize(form) ⇒ PublishResults
constructor
Public: Initializes the command.
Constructor Details
#initialize(form) ⇒ PublishResults
Public: Initializes the command.
form - An ActionForm object with the information needed to publish the results
11 12 13 |
# File 'app/commands/decidim/elections/admin/publish_results.rb', line 11 def initialize(form) @form = form end |
Instance Method Details
#call ⇒ Object
Public: Publish the results for the Election.
Broadcasts :ok if setup, :invalid otherwise.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/commands/decidim/elections/admin/publish_results.rb', line 18 def call return broadcast(:invalid) if form.invalid? transaction do log_action publish_results end broadcast(:ok) rescue StandardError => e broadcast(:invalid, e.) end |