Class: Iron::Settings::IntegrationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/iron/settings/integrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/iron/settings/integrations_controller.rb', line 10

def create
  integration = Integration.new(name: integration_params[:name])
  user = User.new(authenticatable: integration, role: integration_params[:role], language: "en")

  if user.save
    redirect_to settings_integrations_path, flash: { token: integration.token, integration_name: integration.name }, notice: t(".created")
  else
    redirect_to settings_integrations_path, alert: user.errors.full_messages.to_sentence
  end
end

#destroyObject



21
22
23
24
25
# File 'app/controllers/iron/settings/integrations_controller.rb', line 21

def destroy
  user = User.integrations.find(params[:id])
  user.deactivate
  redirect_to settings_integrations_path, notice: t(".revoked"), status: :see_other
end

#indexObject



6
7
8
# File 'app/controllers/iron/settings/integrations_controller.rb', line 6

def index
  @integrations = User.integrations.active.includes(:authenticatable)
end