Sha256: 4fdf6097d6e23fc43d0bcf9e0e360c0fae18458f52b29213140eee1b49d3180b

Contents?: true

Size: 899 Bytes

Versions: 9

Compression:

Stored size: 899 Bytes

Contents

require_dependency "webhooker/application_controller"

module Webhooker
  class SubscribersController < ApplicationController
    before_action :set_subscriber, only: [:destroy]

    # GET /subscribers
    def index
      @subscribers = Subscriber.page(params[:page])
    end

    # POST /subscribers
    def create
      @subscriber = Subscriber.new(subscriber_params)

      if @subscriber.save
        redirect_to subscribers_url, notice: 'Successed to create.'
      else
        redirect_to subscribers_url, alert: 'Failed to create.'
      end
    end

    # DELETE /subscribers/1
    def destroy
      @subscriber.destroy
      redirect_to subscribers_url, notice: 'Successed to destroy.'
    end

    private

    def set_subscriber
      @subscriber = Subscriber.find(params[:id])
    end

    def subscriber_params
      params.require(:subscriber).permit(:url, :secret)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
webhooker-0.5.0 app/controllers/webhooker/subscribers_controller.rb
webhooker-0.4.0 app/controllers/webhooker/subscribers_controller.rb
webhooker-0.3.0 app/controllers/webhooker/subscribers_controller.rb
webhooker-0.2.0 app/controllers/webhooker/subscribers_controller.rb
webhooker-0.1.2 app/controllers/webhooker/subscribers_controller.rb
webhooker-0.1.1 app/controllers/webhooker/subscribers_controller.rb
webhooker-0.1.0 app/controllers/webhooker/subscribers_controller.rb
webhooker-0.0.2 app/controllers/webhooker/subscribers_controller.rb
webhooker-0.0.1 app/controllers/webhooker/subscribers_controller.rb