Class: Decidim::Meetings::CreateResponse
- Inherits:
-
Command
- Object
- Command
- Decidim::Meetings::CreateResponse
- Defined in:
- app/commands/decidim/meetings/create_response.rb
Overview
This command is executed when the user creates an Response in a meeting poll.
Instance Method Summary collapse
-
#call ⇒ Object
Creates the response if valid.
-
#initialize(form, questionnaire) ⇒ CreateResponse
constructor
A new instance of CreateResponse.
Constructor Details
#initialize(form, questionnaire) ⇒ CreateResponse
9 10 11 12 |
# File 'app/commands/decidim/meetings/create_response.rb', line 9 def initialize(form, questionnaire) @form = form @questionnaire = questionnaire end |
Instance Method Details
#call ⇒ Object
Creates the response if valid.
Broadcasts :ok if successful, :invalid otherwise.
17 18 19 20 21 22 23 24 25 |
# File 'app/commands/decidim/meetings/create_response.rb', line 17 def call return broadcast(:invalid) if form.invalid? transaction do response_question end broadcast(:ok) end |