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

Inherits:
Rectify::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

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

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