Class: Decidim::Meetings::Admin::CreateMeeting
- Defined in:
- decidim-meetings/app/commands/decidim/meetings/admin/create_meeting.rb
Overview
This command is executed when the user creates a Meeting from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Creates the meeting if valid.
-
#initialize(form) ⇒ CreateMeeting
constructor
A new instance of CreateMeeting.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form) ⇒ CreateMeeting
Returns a new instance of CreateMeeting.
9 10 11 |
# File 'decidim-meetings/app/commands/decidim/meetings/admin/create_meeting.rb', line 9 def initialize(form) @form = form end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
Creates the meeting if valid.
Broadcasts :ok if successful, :invalid otherwise.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'decidim-meetings/app/commands/decidim/meetings/admin/create_meeting.rb', line 16 def call return broadcast(:invalid) if @form.invalid? transaction do create_meeting! create_services! end create_follow_form_resource(form.current_user) broadcast(:ok, meeting) end |