Class: Decidim::Debates::Admin::UpdateDebate
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Debates::Admin::UpdateDebate
- Defined in:
- app/commands/decidim/debates/admin/update_debate.rb
Overview
This command is executed when the user changes a Debate from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Updates the debate if valid.
-
#initialize(form, debate) ⇒ UpdateDebate
constructor
Initializes a UpdateDebate Command.
Constructor Details
#initialize(form, debate) ⇒ UpdateDebate
Initializes a UpdateDebate Command.
form - The form from which to get the data. debate - The current instance of the page to be updated.
13 14 15 16 |
# File 'app/commands/decidim/debates/admin/update_debate.rb', line 13 def initialize(form, debate) @form = form @debate = debate end |
Instance Method Details
#call ⇒ Object
Updates the debate if valid.
Broadcasts :ok if successful, :invalid otherwise.
21 22 23 24 25 26 |
# File 'app/commands/decidim/debates/admin/update_debate.rb', line 21 def call return broadcast(:invalid) if form.invalid? update_debate broadcast(:ok) end |