Class: Decidim::Accountability::Admin::DestroyResult

Inherits:
Command
  • Object
show all
Defined in:
decidim-accountability/app/commands/decidim/accountability/admin/destroy_result.rb

Overview

This command is executed when the user destroys a Result from the admin panel.

Instance Method Summary collapse

Methods inherited from Command

call, #evaluate, #method_missing, #respond_to_missing?, #transaction

Constructor Details

#initialize(result, current_user) ⇒ DestroyResult

Initializes an UpdateResult Command.

result - The current instance of the result to be destroyed. current_user - the user performing the action


13
14
15
16
# File 'decidim-accountability/app/commands/decidim/accountability/admin/destroy_result.rb', line 13

def initialize(result, current_user)
  @result = result
  @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

#callObject

Destroys the result.

Broadcasts :ok if successful, :invalid otherwise.


21
22
23
24
25
# File 'decidim-accountability/app/commands/decidim/accountability/admin/destroy_result.rb', line 21

def call
  destroy_result

  broadcast(:ok)
end