Sha256: acf738722ada36874b5c6523611095e3daf09fbe1e93bc17d66c1b763488e1e0

Contents?: true

Size: 1.36 KB

Versions: 9

Compression:

Stored size: 1.36 KB

Contents

require_dependency "arcadex/application_controller"

module Arcadex
  class TokensController < ApplicationController
    before_action :set_token, only: [:show, :edit, :update, :destroy]

    # GET /tokens
    def index
      @tokens = Token.all
    end

    # GET /tokens/1
    def show
    end

    # GET /tokens/new
    def new
      @token = Token.new
    end

    # GET /tokens/1/edit
    def edit
    end

    # POST /tokens
    def create
      @token = Token.new(token_params)

      if @token.save
        redirect_to @token, notice: 'Token was successfully created.'
      else
        render :new
      end
    end

    # PATCH/PUT /tokens/1
    def update
      if @token.update(token_params)
        redirect_to @token, notice: 'Token was successfully updated.'
      else
        render :edit
      end
    end

    # DELETE /tokens/1
    def destroy
      @token.destroy
      redirect_to tokens_url, notice: 'Token was successfully destroyed.'
    end

    private
      # Use callbacks to share common setup or constraints between actions.
      def set_token
        @token = Token.find(params[:id])
      end

      # Only allow a trusted parameter "white list" through.
      def token_params
        params.require(:token).permit(:imageable_id, :imageable_type, :auth_token, :first_ip_address, :current_ip_address, :times_used, :expiration_minutes)
      end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
arcadex-1.3.1 app/controllers/arcadex/tokens_controller.rb
arcadex-1.3.0 app/controllers/arcadex/tokens_controller.rb
arcadex-1.2.3 app/controllers/arcadex/tokens_controller.rb
arcadex-1.2.1 app/controllers/arcadex/tokens_controller.rb
arcadex-1.2.0 app/controllers/arcadex/tokens_controller.rb
arcadex-1.1.3 app/controllers/arcadex/tokens_controller.rb
arcadex-1.1.2 app/controllers/arcadex/tokens_controller.rb
arcadex-1.1.1 app/controllers/arcadex/tokens_controller.rb
arcadex-1.1.0 app/controllers/arcadex/tokens_controller.rb