Sha256: f65778d79b946e2607388b375feeab21d5d08291f5d6446fe00c4c46d933095e
Contents?: true
Size: 1.33 KB
Versions: 7
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true module Decidim module ParticipatoryProcesses module Admin # A command with all the business logic when updating a participatory # process type in the system. class UpdateParticipatoryProcessType < Decidim::Command # Public: Initializes the command. # # participatory_process_type - A participatory_process_type object to # update # form - A form object with the params. def initialize(participatory_process_type, form) @participatory_process_type = participatory_process_type @form = form end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the form was not valid and we could not proceed. # # Returns nothing. def call return broadcast(:invalid) if form.invalid? update_participatory_process_type! broadcast(:ok) end private attr_reader :form, :participatory_process_type def update_participatory_process_type! transaction do Decidim.traceability.update!( participatory_process_type, form.current_user, title: form.title ) end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems