Class: Decidim::Meetings::Admin::DestroyMeeting
- Defined in:
- decidim-meetings/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.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
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 'decidim-meetings/app/commands/decidim/meetings/admin/destroy_meeting.rb', line 13 def initialize(meeting, current_user) @meeting = meeting @current_user = current_user end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
Destroys the meeting if valid.
Broadcasts :ok if successful, :invalid otherwise.
21 22 23 24 25 26 |
# File 'decidim-meetings/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 |