Class: Decidim::Accountability::Admin::CreateResult
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Accountability::Admin::CreateResult
- Defined in:
- app/commands/decidim/accountability/admin/create_result.rb
Overview
This command is executed when the user creates a Result from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Creates the result if valid.
-
#initialize(form) ⇒ CreateResult
constructor
A new instance of CreateResult.
Constructor Details
#initialize(form) ⇒ CreateResult
Returns a new instance of CreateResult.
9 10 11 |
# File 'app/commands/decidim/accountability/admin/create_result.rb', line 9 def initialize(form) @form = form end |
Instance Method Details
#call ⇒ Object
Creates the result if valid.
Broadcasts :ok if successful, :invalid otherwise.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/commands/decidim/accountability/admin/create_result.rb', line 16 def call return broadcast(:invalid) if @form.invalid? transaction do create_result link_meetings link_proposals link_projects notify_proposal_followers end broadcast(:ok) end |