Sha256: 6eb5171c48ef5b62fb4e1fe068fd37f5339e734d205e7ce56b214041cbed35f9

Contents?: true

Size: 945 Bytes

Versions: 29

Compression:

Stored size: 945 Bytes

Contents

require_dependency "adeia/application_controller"

module Adeia
  class TokensController < ApplicationController
    load_and_authorize

    def index
      @table = TokenTable.new(self, @tokens)
      @table.respond
    end

    def new
      @token = Token.new(is_valid: true)
    end

    def create
      @token = Token.new(token_params)
      if @token.save
        redirect_to tokens_path, success: t('adeia.tokens.create.success')
      else
        render 'new'
      end
    end

    def edit
    end

    def update
      if @token.update_attributes(token_params)
        redirect_to tokens_path, success: t("adeia.tokens.update.success")
      else
        render 'edit'
      end
    end

    def destroy
      @token.destroy
      redirect_to tokens_path, success: t('adeia.tokens.destroy.success')
    end

    private

    def token_params
      params.require(:token).permit(:permission_id, :exp_at, :is_valid)
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
adeia-0.5.6 app/controllers/adeia/tokens_controller.rb
adeia-0.5.5 app/controllers/adeia/tokens_controller.rb
adeia-0.5.4 app/controllers/adeia/tokens_controller.rb
adeia-0.5.3 app/controllers/adeia/tokens_controller.rb
adeia-0.5.2 app/controllers/adeia/tokens_controller.rb
adeia-0.5.1 app/controllers/adeia/tokens_controller.rb
adeia-0.5.0 app/controllers/adeia/tokens_controller.rb
adeia-0.4.0 app/controllers/adeia/tokens_controller.rb
adeia-0.3.0 app/controllers/adeia/tokens_controller.rb