Class: Decidim::Admin::InviteAdmin

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

Overview

A command to invite an admin.

Instance Method Summary collapse

Methods inherited from Command

call, #evaluate, #method_missing, #respond_to_missing?, #transaction

Constructor Details

#initialize(form) ⇒ InviteAdmin

Public: Initializes the command.

form - A form object with the params.


10
11
12
# File 'decidim-admin/app/commands/decidim/admin/invite_admin.rb', line 10

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

#callObject


14
15
16
17
18
19
20
21
22
23
# File 'decidim-admin/app/commands/decidim/admin/invite_admin.rb', line 14

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

  transaction do
    invite_user
    log_action
  end

  broadcast(:ok)
end