Class: Webhooks::EndpointsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Webhooks::EndpointsController
- Defined in:
- app/controllers/webhooks/endpoints_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/webhooks/endpoints_controller.rb', line 19 def create @endpoint = Webhooks::Endpoint.new(endpoint_params) if @endpoint.save redirect_to endpoint_path(@endpoint), flash: { success: 'Successfully created new webhook endpoint.', } else render :new end end |
#destroy ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/webhooks/endpoints_controller.rb', line 47 def destroy @endpoint = Webhooks::Endpoint.find(params[:id]) if @endpoint.destroy redirect_to endpoints_path, flash: { success: 'Deleted endpoint.', } else redirect_back fallback_location: @endpoint end end |
#edit ⇒ Object
31 32 33 |
# File 'app/controllers/webhooks/endpoints_controller.rb', line 31 def edit @endpoint = Webhooks::Endpoint.find(params[:id]) end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/webhooks/endpoints_controller.rb', line 7 def index @endpoints = Webhooks::Endpoint.order(created_at: :asc) end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/webhooks/endpoints_controller.rb', line 15 def new @endpoint = Webhooks::Endpoint.new end |
#show ⇒ Object
11 12 13 |
# File 'app/controllers/webhooks/endpoints_controller.rb', line 11 def show @endpoint = Webhooks::Endpoint.find(params[:id]) end |
#update ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/webhooks/endpoints_controller.rb', line 35 def update @endpoint = Webhooks::Endpoint.find(params[:id]) if @endpoint.update(endpoint_params) redirect_to edit_endpoint_path(@endpoint), flash: { success: 'Changes saved.', } else render :edit end end |