Class: Decidim::Accountability::Admin::CreateResult
- Defined in:
- decidim-accountability/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.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form) ⇒ CreateResult
Returns a new instance of CreateResult.
9 10 11 |
# File 'decidim-accountability/app/commands/decidim/accountability/admin/create_result.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 result if valid.
Broadcasts :ok if successful, :invalid otherwise.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'decidim-accountability/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 |