Class: Decidim::ParticipatoryDocuments::Admin::CreateSuggestionNote
- Inherits:
-
Command
- Object
- Command
- Decidim::ParticipatoryDocuments::Admin::CreateSuggestionNote
- Defined in:
- app/commands/decidim/participatory_documents/admin/create_suggestion_note.rb
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, suggestion) ⇒ CreateSuggestionNote
constructor
Public: Initializes the command.
Constructor Details
#initialize(form, suggestion) ⇒ CreateSuggestionNote
Public: Initializes the command.
form - A form object with the params. suggestion - the suggestion to relate.
11 12 13 14 |
# File 'app/commands/decidim/participatory_documents/admin/create_suggestion_note.rb', line 11 def initialize(form, suggestion) @form = form @suggestion = suggestion end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid, together with the note proposal.
-
:invalid if the form wasn’t valid and we couldn’t proceed.
Returns nothing.
22 23 24 25 26 27 28 29 |
# File 'app/commands/decidim/participatory_documents/admin/create_suggestion_note.rb', line 22 def call return broadcast(:invalid) if form.invalid? create_suggestion_note # notify_admins_and_valuators broadcast(:ok, suggestion_note) end |