Class: Decidim::Surveys::PublishResponses
- Includes:
- TranslatableAttributes
- Defined in:
- decidim-surveys/app/commands/decidim/surveys/publish_responses.rb
Overview
This command is executed when the admin publishes the Responses from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Publishes the questions’ responses.
-
#initialize(question_id, current_user) ⇒ PublishResponses
constructor
Initializes a PublishResponses Command.
Methods included from TranslatableAttributes
#attachment?, #default_locale?
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(question_id, current_user) ⇒ PublishResponses
Initializes a PublishResponses Command.
12 13 14 15 |
# File 'decidim-surveys/app/commands/decidim/surveys/publish_responses.rb', line 12 def initialize(question_id, current_user) @question_id = question_id @current_user = current_user end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
Publishes the questions’ responses
Broadcasts :ok if successful, :invalid otherwise.
20 21 22 23 24 25 26 27 28 29 |
# File 'decidim-surveys/app/commands/decidim/surveys/publish_responses.rb', line 20 def call transaction do publish_survey_response create_action_log end broadcast(:ok) rescue StandardError broadcast(:invalid) end |