Class: Decidim::Meetings::Admin::DestroyMeeting
- Inherits:
-
Command
- Object
- Command
- Decidim::Meetings::Admin::DestroyMeeting
- Defined in:
- app/commands/decidim/meetings/admin/destroy_meeting.rb
Overview
This command is executed when the user destroys a Meeting from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Destroys the meeting if valid.
-
#initialize(meeting, current_user) ⇒ DestroyMeeting
constructor
Initializes a CloseMeeting Command.
Constructor Details
#initialize(meeting, current_user) ⇒ DestroyMeeting
Initializes a CloseMeeting Command.
meeting - The current instance of the page to be closed. current_user - the user performing the action
13 14 15 16 |
# File 'app/commands/decidim/meetings/admin/destroy_meeting.rb', line 13 def initialize(meeting, current_user) @meeting = meeting @current_user = current_user end |
Instance Method Details
#call ⇒ Object
Destroys the meeting if valid.
Broadcasts :ok if successful, :invalid otherwise.
21 22 23 24 25 26 |
# File 'app/commands/decidim/meetings/admin/destroy_meeting.rb', line 21 def call return broadcast(:invalid, proposals.size) if proposals.any? destroy_meeting broadcast(:ok) end |