Sha256: ee9d35b1208d5da8b7b971246cd8e034892486f98e82f2bb8025c06438ce2a44
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module Decidim module ActionDelegator module Admin class CreateParticipant < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. def initialize(form) @form = form end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the form wasn't valid and we couldn't proceed. # # Returns nothing. def call return broadcast(:invalid) if form.invalid? create_participant broadcast(:ok, participant) end private attr_reader :form, :participant def create_participant @participant = Participant.create!(email: form.email, phone: form.phone, decidim_action_delegator_ponderation_id: form.decidim_action_delegator_ponderation_id, setting: form.setting) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-action_delegator-0.8.1 | app/commands/decidim/action_delegator/admin/create_participant.rb |