Class: Decidim::Surveys::UnpublishResponses
- Inherits:
-
Command
- Object
- Command
- Decidim::Surveys::UnpublishResponses
- Includes:
- TranslatableAttributes
- Defined in:
- app/commands/decidim/surveys/unpublish_responses.rb
Overview
This command is executed when the admin unpublishes the Responses from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Unpublishes the questions’ responses.
-
#initialize(question_id, current_user) ⇒ UnpublishResponses
constructor
Initializes a UnpublishResponses Command.
Constructor Details
#initialize(question_id, current_user) ⇒ UnpublishResponses
Initializes a UnpublishResponses Command.
12 13 14 15 |
# File 'app/commands/decidim/surveys/unpublish_responses.rb', line 12 def initialize(question_id, current_user) @question_id = question_id @current_user = current_user end |
Instance Method Details
#call ⇒ Object
Unpublishes the questions’ responses
Broadcasts :ok if successful, :invalid otherwise.
20 21 22 23 24 25 26 27 28 29 |
# File 'app/commands/decidim/surveys/unpublish_responses.rb', line 20 def call transaction do unpublish_survey_response create_action_log end broadcast(:ok) rescue StandardError broadcast(:invalid) end |