Class: Decidim::Budgets::Admin::DestroyProject

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

Overview

This command is executed when the user deletes a Project from the admin panel.

Instance Method Summary collapse

Methods inherited from Command

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

Constructor Details

#initialize(project, current_user) ⇒ DestroyProject

Initializes an UpdateProject Command.

project - The current instance of the project to be destroyed. current_user - the user that performs the action



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

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

Performs the action.

Broadcasts :ok if successful, :invalid otherwise.



21
22
23
24
# File 'decidim-budgets/app/commands/decidim/budgets/admin/destroy_project.rb', line 21

def call
  destroy_project
  broadcast(:ok)
end