Class: Decidim::ParticipatoryDocuments::Admin::UpdateSuggestionNote

Inherits:
Command
  • Object
show all
Defined in:
app/commands/decidim/participatory_documents/admin/update_suggestion_note.rb

Overview

A command with all the business logic when a user updates a suggestion note.

Instance Method Summary collapse

Constructor Details

#initialize(notes_form, note) ⇒ UpdateSuggestionNote

Public: Initializes the command.

form - A form object with the params. note - the suggestion note to update.



12
13
14
15
# File 'app/commands/decidim/participatory_documents/admin/update_suggestion_note.rb', line 12

def initialize(notes_form, note)
  @notes_form = notes_form
  @note = note
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
# File 'app/commands/decidim/participatory_documents/admin/update_suggestion_note.rb', line 17

def call
  return broadcast(:invalid) if notes_form.invalid?

  update_suggestion_note

  broadcast(:ok, note)
end