Class: Decidim::Meetings::CreateMeeting
- Inherits:
-
Command
- Object
- Command
- 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.
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 |
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 |
# File 'decidim-meetings/app/commands/decidim/meetings/create_meeting.rb', line 15 def call return broadcast(:invalid) if form.invalid? transaction do create_meeting! schedule_upcoming_meeting_notification send_notification end create_follow_form_resource(form.current_user) broadcast(:ok, meeting) end |