Class: Decidim::Meetings::CreateMeeting
- Defined in:
- decidim-meetings/app/commands/decidim/meetings/create_meeting.rb
Overview
This command is executed when a participant or user group creates a Meeting from the public views.
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.
8 9 10 |
# File 'decidim-meetings/app/commands/decidim/meetings/create_meeting.rb', line 8 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.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'decidim-meetings/app/commands/decidim/meetings/create_meeting.rb', line 15 def call return broadcast(:invalid) if form.invalid? with_events(with_transaction: true) do create_meeting! end create_follow_form_resource(form.current_user) schedule_upcoming_meeting_notification send_notification broadcast(:ok, meeting) end |