Class: Decidim::Admin::DestroyArea

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

Overview

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

Instance Method Summary collapse

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 'app/commands/decidim/admin/destroy_area.rb', line 13

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