Class: Admin::WebhookEndpointsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/generators/open_loam/install/templates/admin/webhook_endpoints_controller.rb

Overview

Where this tenant's events get delivered. Structural rather than per-record, like field definitions, so it is gated on the manager role instead of a generated entity policy.

Constant Summary

Constants included from Pagination

Pagination::PER_PAGE

Instance Method Summary collapse

Methods inherited from BaseController

skip_authorization!

Methods included from Pagination

#paginate

Instance Method Details

#create ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/generators/open_loam/install/templates/admin/webhook_endpoints_controller.rb', line 16

def create
  @record = OpenLoam::WebhookEndpoint.new(permitted_params)

  if @record.save
    redirect_to admin_webhook_endpoints_path
  else
    render :new, status: :unprocessable_entity
  end
end

#destroy ⇒ Object



26
27
28
29
# File 'lib/generators/open_loam/install/templates/admin/webhook_endpoints_controller.rb', line 26

def destroy
  OpenLoam::WebhookEndpoint.find(params[:id]).destroy!
  redirect_to admin_webhook_endpoints_path
end

#index ⇒ Object



8
9
10
# File 'lib/generators/open_loam/install/templates/admin/webhook_endpoints_controller.rb', line 8

def index
  @records = OpenLoam::WebhookEndpoint.order(:event_pattern)
end

#new ⇒ Object



12
13
14
# File 'lib/generators/open_loam/install/templates/admin/webhook_endpoints_controller.rb', line 12

def new
  @record = OpenLoam::WebhookEndpoint.new(active: true)
end