Class: Decidim::Admin::DestroyFeature
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Admin::DestroyFeature
- Defined in:
- app/commands/decidim/admin/destroy_feature.rb
Overview
This command deals with destroying a Feature from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Public: Executes the command.
-
#initialize(feature, current_user) ⇒ DestroyFeature
constructor
Public: Initializes the command.
Constructor Details
#initialize(feature, current_user) ⇒ DestroyFeature
Public: Initializes the command.
feature - The Feature to be destroyed. current_user - the user performing the action
11 12 13 14 |
# File 'app/commands/decidim/admin/destroy_feature.rb', line 11 def initialize(feature, current_user) @feature = feature @current_user = current_user end |
Instance Method Details
#call ⇒ Object
Public: Executes the command.
Broadcasts :ok if it got destroyed, raises an exception otherwise.
19 20 21 22 23 24 25 26 |
# File 'app/commands/decidim/admin/destroy_feature.rb', line 19 def call begin destroy_feature rescue StandardError return broadcast(:invalid) end broadcast(:ok) end |