Class: Decidim::Admin::DestroyArea

Inherits:
Commands::DestroyResource show all
Defined in:
decidim-admin/app/commands/decidim/admin/destroy_area.rb

Overview

A command with all the business logic to destroy an area.

Instance Method Summary collapse

Methods inherited from Commands::DestroyResource

#initialize

Methods inherited from Command

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

Constructor Details

This class inherits a constructor from Decidim::Commands::DestroyResource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Decidim::Command

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if the form was not valid and we could not proceed.

Returns nothing.



13
14
15
16
17
18
# File 'decidim-admin/app/commands/decidim/admin/destroy_area.rb', line 13

def call
  destroy_resource
  broadcast(:ok)
rescue ActiveRecord::RecordNotDestroyed
  broadcast(:has_spaces)
end