Class: Decidim::Plans::Admin::DestroyTag

Inherits:
Rectify::Command
  • Object
show all
Defined in:
app/commands/decidim/plans/admin/destroy_tag.rb

Overview

A command with all the business logic when a user destroys a tag.

Instance Method Summary collapse

Constructor Details

#initialize(tag, current_user) ⇒ DestroyTag

Public: Initializes the command.

tag - The target object to be destroyed. current_user - the user performing the action.



12
13
14
15
# File 'app/commands/decidim/plans/admin/destroy_tag.rb', line 12

def initialize(tag, current_user)
  @tag = tag
  @current_user = current_user
end

Instance Method Details

#callObject

Destroys the tag if valid.

Broadcasts :ok if successful, :invalid otherwise.

Returns nothing.



22
23
24
25
26
# File 'app/commands/decidim/plans/admin/destroy_tag.rb', line 22

def call
  destroy_tag

  broadcast(:ok)
end