Class: Webhooks::EventsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/webhooks/events_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/webhooks/events_controller.rb', line 19

def create
  @event = Webhooks::Event.new(event_params)

  if @event.save
    redirect_to event_path(@event), flash: {
      success: 'Successfully created new webhook event.',
    }
  else
    render :new
  end
end

#indexObject



7
8
9
# File 'app/controllers/webhooks/events_controller.rb', line 7

def index
  @events = Webhooks::Event.order(created_at: :desc)
end

#newObject



15
16
17
# File 'app/controllers/webhooks/events_controller.rb', line 15

def new
  @event = Webhooks::Event.new
end

#showObject



11
12
13
# File 'app/controllers/webhooks/events_controller.rb', line 11

def show
  @event = Webhooks::Event.find(params[:id])
end