Class: Decidim::Elections::Admin::UpdateQuestion
- Inherits:
-
Command
- Object
- Command
- Decidim::Elections::Admin::UpdateQuestion
- Defined in:
- app/commands/decidim/elections/admin/update_question.rb
Overview
This command is executed when the user updates a Question from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Updates the question if valid.
-
#initialize(form, question) ⇒ UpdateQuestion
constructor
A new instance of UpdateQuestion.
Constructor Details
#initialize(form, question) ⇒ UpdateQuestion
Returns a new instance of UpdateQuestion.
9 10 11 12 |
# File 'app/commands/decidim/elections/admin/update_question.rb', line 9 def initialize(form, question) @form = form @question = question end |
Instance Method Details
#call ⇒ Object
Updates the question if valid.
Broadcasts :ok if successful, :invalid otherwise.
17 18 19 20 21 22 23 |
# File 'app/commands/decidim/elections/admin/update_question.rb', line 17 def call return broadcast(:invalid) if invalid? update_question! broadcast(:ok, question) end |