Class: Decidim::Meetings::CreateResponse
- Defined in:
- decidim-meetings/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.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form, questionnaire) ⇒ CreateResponse
Returns a new instance of CreateResponse.
9 10 11 12 |
# File 'decidim-meetings/app/commands/decidim/meetings/create_response.rb', line 9 def initialize(form, questionnaire) @form = form @questionnaire = questionnaire end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
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 'decidim-meetings/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 |