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

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

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

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