Class: Decidim::Accountability::Admin::UpdateResult
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Accountability::Admin::UpdateResult
- Defined in:
- app/commands/decidim/accountability/admin/update_result.rb
Overview
This command is executed when the user changes a Result from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Updates the result if valid.
-
#initialize(form, result) ⇒ UpdateResult
constructor
Initializes an UpdateResult Command.
Constructor Details
#initialize(form, result) ⇒ UpdateResult
Initializes an UpdateResult Command.
form - The form from which to get the data. result - The current instance of the result to be updated.
13 14 15 16 |
# File 'app/commands/decidim/accountability/admin/update_result.rb', line 13 def initialize(form, result) @form = form @result = result end |
Instance Method Details
#call ⇒ Object
Updates the result if valid.
Broadcasts :ok if successful, :invalid otherwise.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/commands/decidim/accountability/admin/update_result.rb', line 21 def call return broadcast(:invalid) if form.invalid? transaction do update_result link_proposals link_meetings link_projects send_notifications if should_notify_followers? end broadcast(:ok) end |